raftkvpb

package
v0.0.0-...-d3bda19 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 23 Imported by: 0

README

Protocol Documentation

Table of Contents

Top

proto/v1/raftkv.proto

DeleteRequest
Field Type Label Description
key string

GetRequest
Field Type Label Description
key string

JoinRequest
Field Type Label Description
server_id string
address string

SetRequest
Field Type Label Description
key string
value string

RaftkvService
Method Name Request Type Response Type Description
Get GetRequest .google.protobuf.StringValue Get returns the value for the given key.
Set SetRequest .google.protobuf.Empty Set sets the value for the given key.
Delete DeleteRequest .google.protobuf.Empty Delete removes the given key.
Join JoinRequest .google.protobuf.Empty Join joins the node, identified by nodeID and reachable at address, to the cluster.

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)

Documentation

Overview

Package raftkvpb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_proto_v1_raftkv_proto protoreflect.FileDescriptor
View Source
var RaftkvService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "raftkvpb.v1.RaftkvService",
	HandlerType: (*RaftkvServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Get",
			Handler:    _RaftkvService_Get_Handler,
		},
		{
			MethodName: "Set",
			Handler:    _RaftkvService_Set_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _RaftkvService_Delete_Handler,
		},
		{
			MethodName: "Join",
			Handler:    _RaftkvService_Join_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/v1/raftkv.proto",
}

RaftkvService_ServiceDesc is the grpc.ServiceDesc for RaftkvService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterRaftkvServiceHandler

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

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

func RegisterRaftkvServiceHandlerClient

func RegisterRaftkvServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RaftkvServiceClient) error

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

func RegisterRaftkvServiceHandlerFromEndpoint

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

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

func RegisterRaftkvServiceHandlerServer

func RegisterRaftkvServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RaftkvServiceServer) error

RegisterRaftkvServiceHandlerServer registers the http handlers for service RaftkvService to "mux". UnaryRPC :call RaftkvServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterRaftkvServiceHandlerFromEndpoint instead.

func RegisterRaftkvServiceServer

func RegisterRaftkvServiceServer(s grpc.ServiceRegistrar, srv RaftkvServiceServer)

Types

type DeleteRequest

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

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetKey

func (x *DeleteRequest) GetKey() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type GetRequest

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

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetKey

func (x *GetRequest) GetKey() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type JoinRequest

type JoinRequest struct {
	ServerId string `protobuf:"bytes,1,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"`
	Address  string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

func (*JoinRequest) Descriptor deprecated

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

Deprecated: Use JoinRequest.ProtoReflect.Descriptor instead.

func (*JoinRequest) GetAddress

func (x *JoinRequest) GetAddress() string

func (*JoinRequest) GetServerId

func (x *JoinRequest) GetServerId() string

func (*JoinRequest) ProtoMessage

func (*JoinRequest) ProtoMessage()

func (*JoinRequest) ProtoReflect

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

func (*JoinRequest) Reset

func (x *JoinRequest) Reset()

func (*JoinRequest) String

func (x *JoinRequest) String() string

type RaftkvServiceClient

type RaftkvServiceClient interface {
	// Get returns the value for the given key.
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*wrapperspb.StringValue, error)
	// Set sets the value for the given key.
	Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Delete removes the given key.
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Join joins the node, identified by nodeID and reachable at address, to the cluster.
	Join(ctx context.Context, in *JoinRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

RaftkvServiceClient is the client API for RaftkvService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type RaftkvServiceServer

type RaftkvServiceServer interface {
	// Get returns the value for the given key.
	Get(context.Context, *GetRequest) (*wrapperspb.StringValue, error)
	// Set sets the value for the given key.
	Set(context.Context, *SetRequest) (*emptypb.Empty, error)
	// Delete removes the given key.
	Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
	// Join joins the node, identified by nodeID and reachable at address, to the cluster.
	Join(context.Context, *JoinRequest) (*emptypb.Empty, error)
}

RaftkvServiceServer is the server API for RaftkvService service. All implementations should embed UnimplementedRaftkvServiceServer for forward compatibility

type Server

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

func NewServer

func NewServer(ctx context.Context, gRPCAddr, gRPCGWAddr string, l hclog.Logger, kvserver *kv.Server) (*Server, error)

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop()

type SetRequest

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

func (*SetRequest) Descriptor deprecated

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

Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.

func (*SetRequest) GetKey

func (x *SetRequest) GetKey() string

func (*SetRequest) GetValue

func (x *SetRequest) GetValue() string

func (*SetRequest) ProtoMessage

func (*SetRequest) ProtoMessage()

func (*SetRequest) ProtoReflect

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

func (*SetRequest) Reset

func (x *SetRequest) Reset()

func (*SetRequest) String

func (x *SetRequest) String() string

type UnimplementedRaftkvServiceServer

type UnimplementedRaftkvServiceServer struct {
}

UnimplementedRaftkvServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedRaftkvServiceServer) Delete

func (UnimplementedRaftkvServiceServer) Get

func (UnimplementedRaftkvServiceServer) Join

func (UnimplementedRaftkvServiceServer) Set

type UnsafeRaftkvServiceServer

type UnsafeRaftkvServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeRaftkvServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RaftkvServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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