api

package
v0.0.0-...-233725d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	SenderType_name = map[int32]string{
		0: "SENDER_TYPE_CLIENT",
		1: "SENDER_TYPE_OPLOG",
	}
	SenderType_value = map[string]int32{
		"SENDER_TYPE_CLIENT": 0,
		"SENDER_TYPE_OPLOG":  1,
	}
)

Enum value maps for SenderType.

View Source
var (
	OperationType_name = map[int32]string{
		0: "OPERATION_TYPE_ADD_SHARD",
		1: "OPERATION_TYPE_REMOVE_SHARD",
		2: "OPERATION_TYPE_MAP_KEY",
	}
	OperationType_value = map[string]int32{
		"OPERATION_TYPE_ADD_SHARD":    0,
		"OPERATION_TYPE_REMOVE_SHARD": 1,
		"OPERATION_TYPE_MAP_KEY":      2,
	}
)

Enum value maps for OperationType.

View Source
var File_github_com_amazingchow_engine_consistent_hashing_service_pb_consistent_hashing_service_proto protoreflect.FileDescriptor
View Source
var File_github_com_amazingchow_engine_consistent_hashing_service_pb_oplog_proto protoreflect.FileDescriptor

Functions

func RegisterConsistentHashingServiceHandler

func RegisterConsistentHashingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterConsistentHashingServiceHandler registers the http handlers for service ConsistentHashingService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterConsistentHashingServiceHandlerClient

func RegisterConsistentHashingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ConsistentHashingServiceClient) error

RegisterConsistentHashingServiceHandlerClient registers the http handlers for service ConsistentHashingService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ConsistentHashingServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ConsistentHashingServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ConsistentHashingServiceClient" to call the correct interceptors.

func RegisterConsistentHashingServiceHandlerFromEndpoint

func RegisterConsistentHashingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterConsistentHashingServiceHandlerFromEndpoint is same as RegisterConsistentHashingServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterConsistentHashingServiceHandlerServer

func RegisterConsistentHashingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConsistentHashingServiceServer) error

RegisterConsistentHashingServiceHandlerServer registers the http handlers for service ConsistentHashingService to "mux". UnaryRPC :call ConsistentHashingServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterConsistentHashingServiceServer

func RegisterConsistentHashingServiceServer(s *grpc.Server, srv ConsistentHashingServiceServer)

Types

type AddShardRequest

type AddShardRequest struct {
	Sender SenderType `` /* 128-byte string literal not displayed */
	Shard  *Shard     `protobuf:"bytes,2,opt,name=shard,proto3" json:"shard,omitempty"`
	Record bool       `protobuf:"varint,3,opt,name=record,proto3" json:"record,omitempty"`
	Replay bool       `protobuf:"varint,4,opt,name=replay,proto3" json:"replay,omitempty"`
	// contains filtered or unexported fields
}

---------- request + response ----------

func (*AddShardRequest) Descriptor deprecated

func (*AddShardRequest) Descriptor() ([]byte, []int)

Deprecated: Use AddShardRequest.ProtoReflect.Descriptor instead.

func (*AddShardRequest) GetRecord

func (x *AddShardRequest) GetRecord() bool

func (*AddShardRequest) GetReplay

func (x *AddShardRequest) GetReplay() bool

func (*AddShardRequest) GetSender

func (x *AddShardRequest) GetSender() SenderType

func (*AddShardRequest) GetShard

func (x *AddShardRequest) GetShard() *Shard

func (*AddShardRequest) ProtoMessage

func (*AddShardRequest) ProtoMessage()

func (*AddShardRequest) ProtoReflect

func (x *AddShardRequest) ProtoReflect() protoreflect.Message

func (*AddShardRequest) Reset

func (x *AddShardRequest) Reset()

func (*AddShardRequest) String

func (x *AddShardRequest) String() string

type AddShardResponse

type AddShardResponse struct {
	// contains filtered or unexported fields
}

func (*AddShardResponse) Descriptor deprecated

func (*AddShardResponse) Descriptor() ([]byte, []int)

Deprecated: Use AddShardResponse.ProtoReflect.Descriptor instead.

func (*AddShardResponse) ProtoMessage

func (*AddShardResponse) ProtoMessage()

func (*AddShardResponse) ProtoReflect

func (x *AddShardResponse) ProtoReflect() protoreflect.Message

func (*AddShardResponse) Reset

func (x *AddShardResponse) Reset()

func (*AddShardResponse) String

func (x *AddShardResponse) String() string

type AddShardsRequest

type AddShardsRequest struct {
	Sender SenderType `` /* 128-byte string literal not displayed */
	Shards []*Shard   `protobuf:"bytes,2,rep,name=shards,proto3" json:"shards,omitempty"`
	Record bool       `protobuf:"varint,3,opt,name=record,proto3" json:"record,omitempty"`
	Replay bool       `protobuf:"varint,4,opt,name=replay,proto3" json:"replay,omitempty"`
	// contains filtered or unexported fields
}

func (*AddShardsRequest) Descriptor deprecated

func (*AddShardsRequest) Descriptor() ([]byte, []int)

Deprecated: Use AddShardsRequest.ProtoReflect.Descriptor instead.

func (*AddShardsRequest) GetRecord

func (x *AddShardsRequest) GetRecord() bool

func (*AddShardsRequest) GetReplay

func (x *AddShardsRequest) GetReplay() bool

func (*AddShardsRequest) GetSender

func (x *AddShardsRequest) GetSender() SenderType

func (*AddShardsRequest) GetShards

func (x *AddShardsRequest) GetShards() []*Shard

func (*AddShardsRequest) ProtoMessage

func (*AddShardsRequest) ProtoMessage()

func (*AddShardsRequest) ProtoReflect

func (x *AddShardsRequest) ProtoReflect() protoreflect.Message

func (*AddShardsRequest) Reset

func (x *AddShardsRequest) Reset()

func (*AddShardsRequest) String

func (x *AddShardsRequest) String() string

type AddShardsResponse

type AddShardsResponse struct {
	// contains filtered or unexported fields
}

func (*AddShardsResponse) Descriptor deprecated

func (*AddShardsResponse) Descriptor() ([]byte, []int)

Deprecated: Use AddShardsResponse.ProtoReflect.Descriptor instead.

func (*AddShardsResponse) ProtoMessage

func (*AddShardsResponse) ProtoMessage()

func (*AddShardsResponse) ProtoReflect

func (x *AddShardsResponse) ProtoReflect() protoreflect.Message

func (*AddShardsResponse) Reset

func (x *AddShardsResponse) Reset()

func (*AddShardsResponse) String

func (x *AddShardsResponse) String() string

type ConsistentHashingServiceClient

type ConsistentHashingServiceClient interface {
	AddShard(ctx context.Context, in *AddShardRequest, opts ...grpc.CallOption) (*AddShardResponse, error)
	AddShards(ctx context.Context, in *AddShardsRequest, opts ...grpc.CallOption) (*AddShardsResponse, error)
	DeleteShard(ctx context.Context, in *DeleteShardRequest, opts ...grpc.CallOption) (*DeleteShardResponse, error)
	ListShards(ctx context.Context, in *ListShardsRequest, opts ...grpc.CallOption) (*ListShardsResponse, error)
	MapKey(ctx context.Context, in *MapKeyRequest, opts ...grpc.CallOption) (*MapKeyResponse, error)
}

ConsistentHashingServiceClient is the client API for ConsistentHashingService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type ConsistentHashingServiceServer

ConsistentHashingServiceServer is the server API for ConsistentHashingService service.

type DeleteShardRequest

type DeleteShardRequest struct {
	Sender SenderType `` /* 128-byte string literal not displayed */
	Uuid   string     `protobuf:"bytes,2,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Record bool       `protobuf:"varint,3,opt,name=record,proto3" json:"record,omitempty"`
	Replay bool       `protobuf:"varint,4,opt,name=replay,proto3" json:"replay,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteShardRequest) Descriptor deprecated

func (*DeleteShardRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteShardRequest.ProtoReflect.Descriptor instead.

func (*DeleteShardRequest) GetRecord

func (x *DeleteShardRequest) GetRecord() bool

func (*DeleteShardRequest) GetReplay

func (x *DeleteShardRequest) GetReplay() bool

func (*DeleteShardRequest) GetSender

func (x *DeleteShardRequest) GetSender() SenderType

func (*DeleteShardRequest) GetUuid

func (x *DeleteShardRequest) GetUuid() string

func (*DeleteShardRequest) ProtoMessage

func (*DeleteShardRequest) ProtoMessage()

func (*DeleteShardRequest) ProtoReflect

func (x *DeleteShardRequest) ProtoReflect() protoreflect.Message

func (*DeleteShardRequest) Reset

func (x *DeleteShardRequest) Reset()

func (*DeleteShardRequest) String

func (x *DeleteShardRequest) String() string

type DeleteShardResponse

type DeleteShardResponse struct {
	// contains filtered or unexported fields
}

func (*DeleteShardResponse) Descriptor deprecated

func (*DeleteShardResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteShardResponse.ProtoReflect.Descriptor instead.

func (*DeleteShardResponse) ProtoMessage

func (*DeleteShardResponse) ProtoMessage()

func (*DeleteShardResponse) ProtoReflect

func (x *DeleteShardResponse) ProtoReflect() protoreflect.Message

func (*DeleteShardResponse) Reset

func (x *DeleteShardResponse) Reset()

func (*DeleteShardResponse) String

func (x *DeleteShardResponse) String() string

type Key

type Key struct {
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*Key) Descriptor deprecated

func (*Key) Descriptor() ([]byte, []int)

Deprecated: Use Key.ProtoReflect.Descriptor instead.

func (*Key) GetKey

func (x *Key) GetKey() string

func (*Key) ProtoMessage

func (*Key) ProtoMessage()

func (*Key) ProtoReflect

func (x *Key) ProtoReflect() protoreflect.Message

func (*Key) Reset

func (x *Key) Reset()

func (*Key) String

func (x *Key) String() string

type ListShardsRequest

type ListShardsRequest struct {
	Sender SenderType `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ListShardsRequest) Descriptor deprecated

func (*ListShardsRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListShardsRequest.ProtoReflect.Descriptor instead.

func (*ListShardsRequest) GetSender

func (x *ListShardsRequest) GetSender() SenderType

func (*ListShardsRequest) ProtoMessage

func (*ListShardsRequest) ProtoMessage()

func (*ListShardsRequest) ProtoReflect

func (x *ListShardsRequest) ProtoReflect() protoreflect.Message

func (*ListShardsRequest) Reset

func (x *ListShardsRequest) Reset()

func (*ListShardsRequest) String

func (x *ListShardsRequest) String() string

type ListShardsResponse

type ListShardsResponse struct {
	Shards []*Shard `protobuf:"bytes,1,rep,name=shards,proto3" json:"shards,omitempty"`
	// contains filtered or unexported fields
}

func (*ListShardsResponse) Descriptor deprecated

func (*ListShardsResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListShardsResponse.ProtoReflect.Descriptor instead.

func (*ListShardsResponse) GetShards

func (x *ListShardsResponse) GetShards() []*Shard

func (*ListShardsResponse) ProtoMessage

func (*ListShardsResponse) ProtoMessage()

func (*ListShardsResponse) ProtoReflect

func (x *ListShardsResponse) ProtoReflect() protoreflect.Message

func (*ListShardsResponse) Reset

func (x *ListShardsResponse) Reset()

func (*ListShardsResponse) String

func (x *ListShardsResponse) String() string

type MapKeyRequest

type MapKeyRequest struct {
	Sender SenderType `` /* 128-byte string literal not displayed */
	Key    *Key       `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	Record bool       `protobuf:"varint,3,opt,name=record,proto3" json:"record,omitempty"`
	Replay bool       `protobuf:"varint,4,opt,name=replay,proto3" json:"replay,omitempty"`
	// contains filtered or unexported fields
}

func (*MapKeyRequest) Descriptor deprecated

func (*MapKeyRequest) Descriptor() ([]byte, []int)

Deprecated: Use MapKeyRequest.ProtoReflect.Descriptor instead.

func (*MapKeyRequest) GetKey

func (x *MapKeyRequest) GetKey() *Key

func (*MapKeyRequest) GetRecord

func (x *MapKeyRequest) GetRecord() bool

func (*MapKeyRequest) GetReplay

func (x *MapKeyRequest) GetReplay() bool

func (*MapKeyRequest) GetSender

func (x *MapKeyRequest) GetSender() SenderType

func (*MapKeyRequest) ProtoMessage

func (*MapKeyRequest) ProtoMessage()

func (*MapKeyRequest) ProtoReflect

func (x *MapKeyRequest) ProtoReflect() protoreflect.Message

func (*MapKeyRequest) Reset

func (x *MapKeyRequest) Reset()

func (*MapKeyRequest) String

func (x *MapKeyRequest) String() string

type MapKeyResponse

type MapKeyResponse struct {
	Shard *Shard `protobuf:"bytes,1,opt,name=shard,proto3" json:"shard,omitempty"`
	// contains filtered or unexported fields
}

func (*MapKeyResponse) Descriptor deprecated

func (*MapKeyResponse) Descriptor() ([]byte, []int)

Deprecated: Use MapKeyResponse.ProtoReflect.Descriptor instead.

func (*MapKeyResponse) GetShard

func (x *MapKeyResponse) GetShard() *Shard

func (*MapKeyResponse) ProtoMessage

func (*MapKeyResponse) ProtoMessage()

func (*MapKeyResponse) ProtoReflect

func (x *MapKeyResponse) ProtoReflect() protoreflect.Message

func (*MapKeyResponse) Reset

func (x *MapKeyResponse) Reset()

func (*MapKeyResponse) String

func (x *MapKeyResponse) String() string

type OpLogEntry

type OpLogEntry struct {
	OperationType OperationType        `` /* 166-byte string literal not displayed */
	OperationTime *timestamp.Timestamp `protobuf:"bytes,2,opt,name=operation_time,json=operationTime,proto3" json:"operation_time,omitempty"`
	Payload       []byte               `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*OpLogEntry) Descriptor deprecated

func (*OpLogEntry) Descriptor() ([]byte, []int)

Deprecated: Use OpLogEntry.ProtoReflect.Descriptor instead.

func (*OpLogEntry) GetOperationTime

func (x *OpLogEntry) GetOperationTime() *timestamp.Timestamp

func (*OpLogEntry) GetOperationType

func (x *OpLogEntry) GetOperationType() OperationType

func (*OpLogEntry) GetPayload

func (x *OpLogEntry) GetPayload() []byte

func (*OpLogEntry) ProtoMessage

func (*OpLogEntry) ProtoMessage()

func (*OpLogEntry) ProtoReflect

func (x *OpLogEntry) ProtoReflect() protoreflect.Message

func (*OpLogEntry) Reset

func (x *OpLogEntry) Reset()

func (*OpLogEntry) String

func (x *OpLogEntry) String() string

type OperationType

type OperationType int32
const (
	OperationType_OPERATION_TYPE_ADD_SHARD    OperationType = 0
	OperationType_OPERATION_TYPE_REMOVE_SHARD OperationType = 1
	OperationType_OPERATION_TYPE_MAP_KEY      OperationType = 2
)

func (OperationType) Descriptor

func (OperationType) Enum

func (x OperationType) Enum() *OperationType

func (OperationType) EnumDescriptor deprecated

func (OperationType) EnumDescriptor() ([]byte, []int)

Deprecated: Use OperationType.Descriptor instead.

func (OperationType) Number

func (OperationType) String

func (x OperationType) String() string

func (OperationType) Type

type SenderType

type SenderType int32
const (
	SenderType_SENDER_TYPE_CLIENT SenderType = 0
	SenderType_SENDER_TYPE_OPLOG  SenderType = 1
)

func (SenderType) Descriptor

func (SenderType) Descriptor() protoreflect.EnumDescriptor

func (SenderType) Enum

func (x SenderType) Enum() *SenderType

func (SenderType) EnumDescriptor deprecated

func (SenderType) EnumDescriptor() ([]byte, []int)

Deprecated: Use SenderType.Descriptor instead.

func (SenderType) Number

func (x SenderType) Number() protoreflect.EnumNumber

func (SenderType) String

func (x SenderType) String() string

func (SenderType) Type

type Shard

type Shard struct {

	// uuid is the base64 code of shard ip.
	Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// mapped keys.
	Keys []*Key `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"`
	// contains filtered or unexported fields
}

func (*Shard) Descriptor deprecated

func (*Shard) Descriptor() ([]byte, []int)

Deprecated: Use Shard.ProtoReflect.Descriptor instead.

func (*Shard) GetKeys

func (x *Shard) GetKeys() []*Key

func (*Shard) GetUuid

func (x *Shard) GetUuid() string

func (*Shard) ProtoMessage

func (*Shard) ProtoMessage()

func (*Shard) ProtoReflect

func (x *Shard) ProtoReflect() protoreflect.Message

func (*Shard) Reset

func (x *Shard) Reset()

func (*Shard) String

func (x *Shard) String() string

type UnimplementedConsistentHashingServiceServer

type UnimplementedConsistentHashingServiceServer struct {
}

UnimplementedConsistentHashingServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedConsistentHashingServiceServer) AddShard

func (*UnimplementedConsistentHashingServiceServer) AddShards

func (*UnimplementedConsistentHashingServiceServer) DeleteShard

func (*UnimplementedConsistentHashingServiceServer) ListShards

func (*UnimplementedConsistentHashingServiceServer) MapKey

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL