proto

package
v0.0.0-...-8c4f4f5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var DKV_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.DKV",
	HandlerType: (*DKVServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "KVGet",
			Handler:    _DKV_KVGet_Handler,
		},
		{
			MethodName: "KVPut",
			Handler:    _DKV_KVPut_Handler,
		},
		{
			MethodName: "KVDelete",
			Handler:    _DKV_KVDelete_Handler,
		},
		{
			MethodName: "RaftJoin",
			Handler:    _DKV_RaftJoin_Handler,
		},
		{
			MethodName: "RaftLeave",
			Handler:    _DKV_RaftLeave_Handler,
		},
		{
			MethodName: "RaftState",
			Handler:    _DKV_RaftState_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "dkv.proto",
}

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

Functions

func RegisterDKVHandler

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

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

func RegisterDKVHandlerClient

func RegisterDKVHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DKVClient) error

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

func RegisterDKVHandlerFromEndpoint

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

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

func RegisterDKVHandlerServer

func RegisterDKVHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DKVServer) error

RegisterDKVHandlerServer registers the http handlers for service DKV to "mux". UnaryRPC :call DKVServer 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 RegisterDKVHandlerFromEndpoint instead.

func RegisterDKVServer

func RegisterDKVServer(s grpc.ServiceRegistrar, srv DKVServer)

Types

type DKVClient

type DKVClient interface {
	KVGet(ctx context.Context, in *KVGetRequest, opts ...grpc.CallOption) (*KVGetResponse, error)
	KVPut(ctx context.Context, in *KVPutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	KVDelete(ctx context.Context, in *KVDeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	RaftJoin(ctx context.Context, in *RaftJoinRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	RaftLeave(ctx context.Context, in *RaftLeaveRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	RaftState(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*RaftStateResponse, error)
}

DKVClient is the client API for DKV 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 NewDKVClient

func NewDKVClient(cc grpc.ClientConnInterface) DKVClient

type DKVServer

type DKVServer interface {
	KVGet(context.Context, *KVGetRequest) (*KVGetResponse, error)
	KVPut(context.Context, *KVPutRequest) (*emptypb.Empty, error)
	KVDelete(context.Context, *KVDeleteRequest) (*emptypb.Empty, error)
	RaftJoin(context.Context, *RaftJoinRequest) (*emptypb.Empty, error)
	RaftLeave(context.Context, *RaftLeaveRequest) (*emptypb.Empty, error)
	RaftState(context.Context, *emptypb.Empty) (*RaftStateResponse, error)
	// contains filtered or unexported methods
}

DKVServer is the server API for DKV service. All implementations must embed UnimplementedDKVServer for forward compatibility

type KVDeleteRequest

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

func (*KVDeleteRequest) Descriptor deprecated

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

Deprecated: Use KVDeleteRequest.ProtoReflect.Descriptor instead.

func (*KVDeleteRequest) GetKey

func (x *KVDeleteRequest) GetKey() string

func (*KVDeleteRequest) ProtoMessage

func (*KVDeleteRequest) ProtoMessage()

func (*KVDeleteRequest) ProtoReflect

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

func (*KVDeleteRequest) Reset

func (x *KVDeleteRequest) Reset()

func (*KVDeleteRequest) String

func (x *KVDeleteRequest) String() string

type KVGetRequest

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

func (*KVGetRequest) Descriptor deprecated

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

Deprecated: Use KVGetRequest.ProtoReflect.Descriptor instead.

func (*KVGetRequest) GetKey

func (x *KVGetRequest) GetKey() string

func (*KVGetRequest) ProtoMessage

func (*KVGetRequest) ProtoMessage()

func (*KVGetRequest) ProtoReflect

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

func (*KVGetRequest) Reset

func (x *KVGetRequest) Reset()

func (*KVGetRequest) String

func (x *KVGetRequest) String() string

type KVGetResponse

type KVGetResponse struct {
	Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*KVGetResponse) Descriptor deprecated

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

Deprecated: Use KVGetResponse.ProtoReflect.Descriptor instead.

func (*KVGetResponse) GetValue

func (x *KVGetResponse) GetValue() []byte

func (*KVGetResponse) ProtoMessage

func (*KVGetResponse) ProtoMessage()

func (*KVGetResponse) ProtoReflect

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

func (*KVGetResponse) Reset

func (x *KVGetResponse) Reset()

func (*KVGetResponse) String

func (x *KVGetResponse) String() string

type KVPutRequest

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

func (*KVPutRequest) Descriptor deprecated

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

Deprecated: Use KVPutRequest.ProtoReflect.Descriptor instead.

func (*KVPutRequest) GetKey

func (x *KVPutRequest) GetKey() string

func (*KVPutRequest) GetValue

func (x *KVPutRequest) GetValue() []byte

func (*KVPutRequest) ProtoMessage

func (*KVPutRequest) ProtoMessage()

func (*KVPutRequest) ProtoReflect

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

func (*KVPutRequest) Reset

func (x *KVPutRequest) Reset()

func (*KVPutRequest) String

func (x *KVPutRequest) String() string

type KeyValueStore

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

func (*KeyValueStore) Descriptor deprecated

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

Deprecated: Use KeyValueStore.ProtoReflect.Descriptor instead.

func (*KeyValueStore) GetKey

func (x *KeyValueStore) GetKey() string

func (*KeyValueStore) GetValue

func (x *KeyValueStore) GetValue() []byte

func (*KeyValueStore) ProtoMessage

func (*KeyValueStore) ProtoMessage()

func (*KeyValueStore) ProtoReflect

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

func (*KeyValueStore) Reset

func (x *KeyValueStore) Reset()

func (*KeyValueStore) String

func (x *KeyValueStore) String() string

type RaftJoinRequest

type RaftJoinRequest struct {
	NodeId      string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
	NodeAddress string `protobuf:"bytes,2,opt,name=node_address,json=nodeAddress,proto3" json:"node_address,omitempty"`
	// contains filtered or unexported fields
}

func (*RaftJoinRequest) Descriptor deprecated

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

Deprecated: Use RaftJoinRequest.ProtoReflect.Descriptor instead.

func (*RaftJoinRequest) GetNodeAddress

func (x *RaftJoinRequest) GetNodeAddress() string

func (*RaftJoinRequest) GetNodeId

func (x *RaftJoinRequest) GetNodeId() string

func (*RaftJoinRequest) ProtoMessage

func (*RaftJoinRequest) ProtoMessage()

func (*RaftJoinRequest) ProtoReflect

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

func (*RaftJoinRequest) Reset

func (x *RaftJoinRequest) Reset()

func (*RaftJoinRequest) String

func (x *RaftJoinRequest) String() string

type RaftLeaveRequest

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

func (*RaftLeaveRequest) Descriptor deprecated

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

Deprecated: Use RaftLeaveRequest.ProtoReflect.Descriptor instead.

func (*RaftLeaveRequest) GetNodeId

func (x *RaftLeaveRequest) GetNodeId() string

func (*RaftLeaveRequest) ProtoMessage

func (*RaftLeaveRequest) ProtoMessage()

func (*RaftLeaveRequest) ProtoReflect

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

func (*RaftLeaveRequest) Reset

func (x *RaftLeaveRequest) Reset()

func (*RaftLeaveRequest) String

func (x *RaftLeaveRequest) String() string

type RaftStateResponse

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

func (*RaftStateResponse) Descriptor deprecated

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

Deprecated: Use RaftStateResponse.ProtoReflect.Descriptor instead.

func (*RaftStateResponse) GetRaftState

func (x *RaftStateResponse) GetRaftState() string

func (*RaftStateResponse) ProtoMessage

func (*RaftStateResponse) ProtoMessage()

func (*RaftStateResponse) ProtoReflect

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

func (*RaftStateResponse) Reset

func (x *RaftStateResponse) Reset()

func (*RaftStateResponse) String

func (x *RaftStateResponse) String() string

type UnimplementedDKVServer

type UnimplementedDKVServer struct {
}

UnimplementedDKVServer must be embedded to have forward compatible implementations.

func (UnimplementedDKVServer) KVDelete

func (UnimplementedDKVServer) KVGet

func (UnimplementedDKVServer) KVPut

func (UnimplementedDKVServer) RaftJoin

func (UnimplementedDKVServer) RaftLeave

func (UnimplementedDKVServer) RaftState

type UnsafeDKVServer

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

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

Jump to

Keyboard shortcuts

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