Documentation ¶
Index ¶
Constants ¶
const ( KV_Get_FullMethodName = "/KV/Get" KV_Set_FullMethodName = "/KV/Set" KV_Delete_FullMethodName = "/KV/Delete" )
Variables ¶
var ErrKeyNotFound = errors.New("key not found")
ErrKeyNotFound is an error returned when the provided key is not found in the underlying storage for the KV service.
var File_internal_kvpb_kv_proto protoreflect.FileDescriptor
var KV_ServiceDesc = grpc.ServiceDesc{ ServiceName: "KV", HandlerType: (*KVServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Get", Handler: _KV_Get_Handler, }, { MethodName: "Set", Handler: _KV_Set_Handler, }, { MethodName: "Delete", Handler: _KV_Delete_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "internal/kvpb/kv.proto", }
KV_ServiceDesc is the grpc.ServiceDesc for KV service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterKVServer ¶
func RegisterKVServer(s grpc.ServiceRegistrar, srv KVServer)
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 GetResponse ¶
type GetResponse 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 (*GetResponse) Descriptor
deprecated
func (*GetResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.
func (*GetResponse) GetKey ¶
func (x *GetResponse) GetKey() string
func (*GetResponse) GetValue ¶
func (x *GetResponse) GetValue() string
func (*GetResponse) ProtoMessage ¶
func (*GetResponse) ProtoMessage()
func (*GetResponse) ProtoReflect ¶
func (x *GetResponse) ProtoReflect() protoreflect.Message
func (*GetResponse) Reset ¶
func (x *GetResponse) Reset()
func (*GetResponse) String ¶
func (x *GetResponse) String() string
type KVClient ¶
type KVClient interface { Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) }
KVClient is the client API for KV 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.
func NewKVClient ¶
func NewKVClient(cc grpc.ClientConnInterface) KVClient
type KVServer ¶
type KVServer interface { Get(context.Context, *GetRequest) (*GetResponse, error) Set(context.Context, *SetRequest) (*emptypb.Empty, error) Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error) }
KVServer is the server API for KV service. All implementations should embed UnimplementedKVServer for forward compatibility
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 UnimplementedKVServer ¶
type UnimplementedKVServer struct { }
UnimplementedKVServer should be embedded to have forward compatible implementations.
func (UnimplementedKVServer) Delete ¶
func (UnimplementedKVServer) Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
func (UnimplementedKVServer) Get ¶
func (UnimplementedKVServer) Get(context.Context, *GetRequest) (*GetResponse, error)
func (UnimplementedKVServer) Set ¶
func (UnimplementedKVServer) Set(context.Context, *SetRequest) (*emptypb.Empty, error)
type UnsafeKVServer ¶
type UnsafeKVServer interface {
// contains filtered or unexported methods
}
UnsafeKVServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to KVServer will result in compilation errors.