kv_store_grpc

package
v0.0.0-...-c37f80e Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package kv_store_grpc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_kv_svc_proto protoreflect.FileDescriptor
View Source
var KVService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "kv_store_grpc.KVService",
	HandlerType: (*KVServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateKV",
			Handler:    _KVService_CreateKV_Handler,
		},
		{
			MethodName: "DeleteKV",
			Handler:    _KVService_DeleteKV_Handler,
		},
		{
			MethodName: "GetKV",
			Handler:    _KVService_GetKV_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "kv-svc.proto",
}

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

Functions

func RegisterKVServiceHandler

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

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

func RegisterKVServiceHandlerClient

func RegisterKVServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client KVServiceClient) error

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

func RegisterKVServiceHandlerFromEndpoint

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

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

func RegisterKVServiceHandlerServer

func RegisterKVServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server KVServiceServer) error

RegisterKVServiceHandlerServer registers the http handlers for service KVService to "mux". UnaryRPC :call KVServiceServer 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 RegisterKVServiceHandlerFromEndpoint instead.

func RegisterKVServiceServer

func RegisterKVServiceServer(s grpc.ServiceRegistrar, srv KVServiceServer)

Types

type DeleteKVRequest

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

func (*DeleteKVRequest) Descriptor deprecated

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

Deprecated: Use DeleteKVRequest.ProtoReflect.Descriptor instead.

func (*DeleteKVRequest) GetKey

func (x *DeleteKVRequest) GetKey() string

func (*DeleteKVRequest) ProtoMessage

func (*DeleteKVRequest) ProtoMessage()

func (*DeleteKVRequest) ProtoReflect

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

func (*DeleteKVRequest) Reset

func (x *DeleteKVRequest) Reset()

func (*DeleteKVRequest) String

func (x *DeleteKVRequest) String() string

type GetKVRequest

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

func (*GetKVRequest) Descriptor deprecated

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

Deprecated: Use GetKVRequest.ProtoReflect.Descriptor instead.

func (*GetKVRequest) GetKey

func (x *GetKVRequest) GetKey() string

func (*GetKVRequest) ProtoMessage

func (*GetKVRequest) ProtoMessage()

func (*GetKVRequest) ProtoReflect

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

func (*GetKVRequest) Reset

func (x *GetKVRequest) Reset()

func (*GetKVRequest) String

func (x *GetKVRequest) String() string

type KVMessage

type KVMessage 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 (*KVMessage) Descriptor deprecated

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

Deprecated: Use KVMessage.ProtoReflect.Descriptor instead.

func (*KVMessage) GetKey

func (x *KVMessage) GetKey() string

func (*KVMessage) GetValue

func (x *KVMessage) GetValue() string

func (*KVMessage) ProtoMessage

func (*KVMessage) ProtoMessage()

func (*KVMessage) ProtoReflect

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

func (*KVMessage) Reset

func (x *KVMessage) Reset()

func (*KVMessage) String

func (x *KVMessage) String() string

type KVServiceClient

type KVServiceClient interface {
	// rpc CreateKV(google.protobuf.Empty) returns (KVMessage) {
	CreateKV(ctx context.Context, in *KVMessage, opts ...grpc.CallOption) (*KVMessage, error)
	DeleteKV(ctx context.Context, in *DeleteKVRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	GetKV(ctx context.Context, in *GetKVRequest, opts ...grpc.CallOption) (*KVMessage, error)
}

KVServiceClient is the client API for KVService 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 NewKVServiceClient

func NewKVServiceClient(cc grpc.ClientConnInterface) KVServiceClient

type KVServiceServer

type KVServiceServer interface {
	// rpc CreateKV(google.protobuf.Empty) returns (KVMessage) {
	CreateKV(context.Context, *KVMessage) (*KVMessage, error)
	DeleteKV(context.Context, *DeleteKVRequest) (*emptypb.Empty, error)
	GetKV(context.Context, *GetKVRequest) (*KVMessage, error)
	// contains filtered or unexported methods
}

KVServiceServer is the server API for KVService service. All implementations must embed UnimplementedKVServiceServer for forward compatibility

type UnimplementedKVServiceServer

type UnimplementedKVServiceServer struct {
}

UnimplementedKVServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedKVServiceServer) CreateKV

func (UnimplementedKVServiceServer) DeleteKV

func (UnimplementedKVServiceServer) GetKV

type UnsafeKVServiceServer

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

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

Jump to

Keyboard shortcuts

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