Documentation
¶
Overview ¶
Package proto is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterRaftServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterRaftServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RaftServiceClient) error
- func RegisterRaftServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterRaftServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RaftServiceServer) error
- func RegisterRaftServiceServer(s grpc.ServiceRegistrar, srv RaftServiceServer)
- type AddPeerRequest
- func (*AddPeerRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddPeerRequest) GetGrpcAddress() string
- func (x *AddPeerRequest) GetPeerAddress() string
- func (x *AddPeerRequest) GetPeerId() string
- func (*AddPeerRequest) ProtoMessage()
- func (x *AddPeerRequest) ProtoReflect() protoreflect.Message
- func (x *AddPeerRequest) Reset()
- func (x *AddPeerRequest) String() string
- type AddPeerResponse
- type ForwardApplyRequest
- func (*ForwardApplyRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ForwardApplyRequest) GetData() []byte
- func (x *ForwardApplyRequest) GetTimeoutMs() int64
- func (*ForwardApplyRequest) ProtoMessage()
- func (x *ForwardApplyRequest) ProtoReflect() protoreflect.Message
- func (x *ForwardApplyRequest) Reset()
- func (x *ForwardApplyRequest) String() string
- type ForwardApplyResponse
- func (*ForwardApplyResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ForwardApplyResponse) GetSuccess() bool
- func (*ForwardApplyResponse) ProtoMessage()
- func (x *ForwardApplyResponse) ProtoReflect() protoreflect.Message
- func (x *ForwardApplyResponse) Reset()
- func (x *ForwardApplyResponse) String() string
- type GetPeerInfoRequest
- func (*GetPeerInfoRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetPeerInfoRequest) GetPeerId() string
- func (*GetPeerInfoRequest) ProtoMessage()
- func (x *GetPeerInfoRequest) ProtoReflect() protoreflect.Message
- func (x *GetPeerInfoRequest) Reset()
- func (x *GetPeerInfoRequest) String() string
- type GetPeerInfoResponse
- func (*GetPeerInfoResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetPeerInfoResponse) GetExists() bool
- func (x *GetPeerInfoResponse) GetGrpcAddress() string
- func (*GetPeerInfoResponse) ProtoMessage()
- func (x *GetPeerInfoResponse) ProtoReflect() protoreflect.Message
- func (x *GetPeerInfoResponse) Reset()
- func (x *GetPeerInfoResponse) String() string
- type RaftServiceClient
- type RaftServiceServer
- type RemovePeerRequest
- type RemovePeerResponse
- func (*RemovePeerResponse) Descriptor() ([]byte, []int)deprecated
- func (x *RemovePeerResponse) GetSuccess() bool
- func (*RemovePeerResponse) ProtoMessage()
- func (x *RemovePeerResponse) ProtoReflect() protoreflect.Message
- func (x *RemovePeerResponse) Reset()
- func (x *RemovePeerResponse) String() string
- type UnimplementedRaftServiceServer
- func (UnimplementedRaftServiceServer) AddPeer(context.Context, *AddPeerRequest) (*AddPeerResponse, error)
- func (UnimplementedRaftServiceServer) ForwardApply(context.Context, *ForwardApplyRequest) (*ForwardApplyResponse, error)
- func (UnimplementedRaftServiceServer) GetPeerInfo(context.Context, *GetPeerInfoRequest) (*GetPeerInfoResponse, error)
- func (UnimplementedRaftServiceServer) RemovePeer(context.Context, *RemovePeerRequest) (*RemovePeerResponse, error)
- type UnsafeRaftServiceServer
Constants ¶
const ( RaftService_ForwardApply_FullMethodName = "/raft.RaftService/ForwardApply" RaftService_AddPeer_FullMethodName = "/raft.RaftService/AddPeer" RaftService_RemovePeer_FullMethodName = "/raft.RaftService/RemovePeer" RaftService_GetPeerInfo_FullMethodName = "/raft.RaftService/GetPeerInfo" )
Variables ¶
var File_raft_proto_raft_proto protoreflect.FileDescriptor
var RaftService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "raft.RaftService", HandlerType: (*RaftServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ForwardApply", Handler: _RaftService_ForwardApply_Handler, }, { MethodName: "AddPeer", Handler: _RaftService_AddPeer_Handler, }, { MethodName: "RemovePeer", Handler: _RaftService_RemovePeer_Handler, }, { MethodName: "GetPeerInfo", Handler: _RaftService_GetPeerInfo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "raft/proto/raft.proto", }
RaftService_ServiceDesc is the grpc.ServiceDesc for RaftService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRaftServiceHandler ¶
func RegisterRaftServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterRaftServiceHandler registers the http handlers for service RaftService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterRaftServiceHandlerClient ¶
func RegisterRaftServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RaftServiceClient) error
RegisterRaftServiceHandlerClient registers the http handlers for service RaftService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RaftServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RaftServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "RaftServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterRaftServiceHandlerFromEndpoint ¶
func RegisterRaftServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterRaftServiceHandlerFromEndpoint is same as RegisterRaftServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterRaftServiceHandlerServer ¶
func RegisterRaftServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RaftServiceServer) error
RegisterRaftServiceHandlerServer registers the http handlers for service RaftService to "mux". UnaryRPC :call RaftServiceServer 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 RegisterRaftServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterRaftServiceServer ¶
func RegisterRaftServiceServer(s grpc.ServiceRegistrar, srv RaftServiceServer)
Types ¶
type AddPeerRequest ¶ added in v0.10.2
type AddPeerRequest struct { PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` PeerAddress string `protobuf:"bytes,2,opt,name=peer_address,json=peerAddress,proto3" json:"peer_address,omitempty"` GrpcAddress string `protobuf:"bytes,3,opt,name=grpc_address,json=grpcAddress,proto3" json:"grpc_address,omitempty"` // contains filtered or unexported fields }
func (*AddPeerRequest) Descriptor
deprecated
added in
v0.10.2
func (*AddPeerRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddPeerRequest.ProtoReflect.Descriptor instead.
func (*AddPeerRequest) GetGrpcAddress ¶ added in v0.10.2
func (x *AddPeerRequest) GetGrpcAddress() string
func (*AddPeerRequest) GetPeerAddress ¶ added in v0.10.2
func (x *AddPeerRequest) GetPeerAddress() string
func (*AddPeerRequest) GetPeerId ¶ added in v0.10.2
func (x *AddPeerRequest) GetPeerId() string
func (*AddPeerRequest) ProtoMessage ¶ added in v0.10.2
func (*AddPeerRequest) ProtoMessage()
func (*AddPeerRequest) ProtoReflect ¶ added in v0.10.2
func (x *AddPeerRequest) ProtoReflect() protoreflect.Message
func (*AddPeerRequest) Reset ¶ added in v0.10.2
func (x *AddPeerRequest) Reset()
func (*AddPeerRequest) String ¶ added in v0.10.2
func (x *AddPeerRequest) String() string
type AddPeerResponse ¶ added in v0.10.2
type AddPeerResponse struct { Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // contains filtered or unexported fields }
func (*AddPeerResponse) Descriptor
deprecated
added in
v0.10.2
func (*AddPeerResponse) Descriptor() ([]byte, []int)
Deprecated: Use AddPeerResponse.ProtoReflect.Descriptor instead.
func (*AddPeerResponse) GetSuccess ¶ added in v0.10.2
func (x *AddPeerResponse) GetSuccess() bool
func (*AddPeerResponse) ProtoMessage ¶ added in v0.10.2
func (*AddPeerResponse) ProtoMessage()
func (*AddPeerResponse) ProtoReflect ¶ added in v0.10.2
func (x *AddPeerResponse) ProtoReflect() protoreflect.Message
func (*AddPeerResponse) Reset ¶ added in v0.10.2
func (x *AddPeerResponse) Reset()
func (*AddPeerResponse) String ¶ added in v0.10.2
func (x *AddPeerResponse) String() string
type ForwardApplyRequest ¶
type ForwardApplyRequest struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` TimeoutMs int64 `protobuf:"varint,2,opt,name=timeout_ms,json=timeoutMs,proto3" json:"timeout_ms,omitempty"` // contains filtered or unexported fields }
func (*ForwardApplyRequest) Descriptor
deprecated
func (*ForwardApplyRequest) Descriptor() ([]byte, []int)
Deprecated: Use ForwardApplyRequest.ProtoReflect.Descriptor instead.
func (*ForwardApplyRequest) GetData ¶
func (x *ForwardApplyRequest) GetData() []byte
func (*ForwardApplyRequest) GetTimeoutMs ¶
func (x *ForwardApplyRequest) GetTimeoutMs() int64
func (*ForwardApplyRequest) ProtoMessage ¶
func (*ForwardApplyRequest) ProtoMessage()
func (*ForwardApplyRequest) ProtoReflect ¶
func (x *ForwardApplyRequest) ProtoReflect() protoreflect.Message
func (*ForwardApplyRequest) Reset ¶
func (x *ForwardApplyRequest) Reset()
func (*ForwardApplyRequest) String ¶
func (x *ForwardApplyRequest) String() string
type ForwardApplyResponse ¶
type ForwardApplyResponse struct { Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // contains filtered or unexported fields }
func (*ForwardApplyResponse) Descriptor
deprecated
func (*ForwardApplyResponse) Descriptor() ([]byte, []int)
Deprecated: Use ForwardApplyResponse.ProtoReflect.Descriptor instead.
func (*ForwardApplyResponse) GetSuccess ¶
func (x *ForwardApplyResponse) GetSuccess() bool
func (*ForwardApplyResponse) ProtoMessage ¶
func (*ForwardApplyResponse) ProtoMessage()
func (*ForwardApplyResponse) ProtoReflect ¶
func (x *ForwardApplyResponse) ProtoReflect() protoreflect.Message
func (*ForwardApplyResponse) Reset ¶
func (x *ForwardApplyResponse) Reset()
func (*ForwardApplyResponse) String ¶
func (x *ForwardApplyResponse) String() string
type GetPeerInfoRequest ¶ added in v0.10.2
type GetPeerInfoRequest struct { PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` // contains filtered or unexported fields }
func (*GetPeerInfoRequest) Descriptor
deprecated
added in
v0.10.2
func (*GetPeerInfoRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetPeerInfoRequest.ProtoReflect.Descriptor instead.
func (*GetPeerInfoRequest) GetPeerId ¶ added in v0.10.2
func (x *GetPeerInfoRequest) GetPeerId() string
func (*GetPeerInfoRequest) ProtoMessage ¶ added in v0.10.2
func (*GetPeerInfoRequest) ProtoMessage()
func (*GetPeerInfoRequest) ProtoReflect ¶ added in v0.10.2
func (x *GetPeerInfoRequest) ProtoReflect() protoreflect.Message
func (*GetPeerInfoRequest) Reset ¶ added in v0.10.2
func (x *GetPeerInfoRequest) Reset()
func (*GetPeerInfoRequest) String ¶ added in v0.10.2
func (x *GetPeerInfoRequest) String() string
type GetPeerInfoResponse ¶ added in v0.10.2
type GetPeerInfoResponse struct { Exists bool `protobuf:"varint,1,opt,name=exists,proto3" json:"exists,omitempty"` GrpcAddress string `protobuf:"bytes,2,opt,name=grpc_address,json=grpcAddress,proto3" json:"grpc_address,omitempty"` // contains filtered or unexported fields }
func (*GetPeerInfoResponse) Descriptor
deprecated
added in
v0.10.2
func (*GetPeerInfoResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetPeerInfoResponse.ProtoReflect.Descriptor instead.
func (*GetPeerInfoResponse) GetExists ¶ added in v0.10.2
func (x *GetPeerInfoResponse) GetExists() bool
func (*GetPeerInfoResponse) GetGrpcAddress ¶ added in v0.10.2
func (x *GetPeerInfoResponse) GetGrpcAddress() string
func (*GetPeerInfoResponse) ProtoMessage ¶ added in v0.10.2
func (*GetPeerInfoResponse) ProtoMessage()
func (*GetPeerInfoResponse) ProtoReflect ¶ added in v0.10.2
func (x *GetPeerInfoResponse) ProtoReflect() protoreflect.Message
func (*GetPeerInfoResponse) Reset ¶ added in v0.10.2
func (x *GetPeerInfoResponse) Reset()
func (*GetPeerInfoResponse) String ¶ added in v0.10.2
func (x *GetPeerInfoResponse) String() string
type RaftServiceClient ¶
type RaftServiceClient interface { ForwardApply(ctx context.Context, in *ForwardApplyRequest, opts ...grpc.CallOption) (*ForwardApplyResponse, error) AddPeer(ctx context.Context, in *AddPeerRequest, opts ...grpc.CallOption) (*AddPeerResponse, error) RemovePeer(ctx context.Context, in *RemovePeerRequest, opts ...grpc.CallOption) (*RemovePeerResponse, error) GetPeerInfo(ctx context.Context, in *GetPeerInfoRequest, opts ...grpc.CallOption) (*GetPeerInfoResponse, error) }
RaftServiceClient is the client API for RaftService 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 NewRaftServiceClient ¶
func NewRaftServiceClient(cc grpc.ClientConnInterface) RaftServiceClient
type RaftServiceServer ¶
type RaftServiceServer interface { ForwardApply(context.Context, *ForwardApplyRequest) (*ForwardApplyResponse, error) AddPeer(context.Context, *AddPeerRequest) (*AddPeerResponse, error) RemovePeer(context.Context, *RemovePeerRequest) (*RemovePeerResponse, error) GetPeerInfo(context.Context, *GetPeerInfoRequest) (*GetPeerInfoResponse, error) // contains filtered or unexported methods }
RaftServiceServer is the server API for RaftService service. All implementations must embed UnimplementedRaftServiceServer for forward compatibility.
type RemovePeerRequest ¶ added in v0.10.2
type RemovePeerRequest struct { PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` // contains filtered or unexported fields }
func (*RemovePeerRequest) Descriptor
deprecated
added in
v0.10.2
func (*RemovePeerRequest) Descriptor() ([]byte, []int)
Deprecated: Use RemovePeerRequest.ProtoReflect.Descriptor instead.
func (*RemovePeerRequest) GetPeerId ¶ added in v0.10.2
func (x *RemovePeerRequest) GetPeerId() string
func (*RemovePeerRequest) ProtoMessage ¶ added in v0.10.2
func (*RemovePeerRequest) ProtoMessage()
func (*RemovePeerRequest) ProtoReflect ¶ added in v0.10.2
func (x *RemovePeerRequest) ProtoReflect() protoreflect.Message
func (*RemovePeerRequest) Reset ¶ added in v0.10.2
func (x *RemovePeerRequest) Reset()
func (*RemovePeerRequest) String ¶ added in v0.10.2
func (x *RemovePeerRequest) String() string
type RemovePeerResponse ¶ added in v0.10.2
type RemovePeerResponse struct { Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // contains filtered or unexported fields }
func (*RemovePeerResponse) Descriptor
deprecated
added in
v0.10.2
func (*RemovePeerResponse) Descriptor() ([]byte, []int)
Deprecated: Use RemovePeerResponse.ProtoReflect.Descriptor instead.
func (*RemovePeerResponse) GetSuccess ¶ added in v0.10.2
func (x *RemovePeerResponse) GetSuccess() bool
func (*RemovePeerResponse) ProtoMessage ¶ added in v0.10.2
func (*RemovePeerResponse) ProtoMessage()
func (*RemovePeerResponse) ProtoReflect ¶ added in v0.10.2
func (x *RemovePeerResponse) ProtoReflect() protoreflect.Message
func (*RemovePeerResponse) Reset ¶ added in v0.10.2
func (x *RemovePeerResponse) Reset()
func (*RemovePeerResponse) String ¶ added in v0.10.2
func (x *RemovePeerResponse) String() string
type UnimplementedRaftServiceServer ¶
type UnimplementedRaftServiceServer struct{}
UnimplementedRaftServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedRaftServiceServer) AddPeer ¶ added in v0.10.2
func (UnimplementedRaftServiceServer) AddPeer(context.Context, *AddPeerRequest) (*AddPeerResponse, error)
func (UnimplementedRaftServiceServer) ForwardApply ¶
func (UnimplementedRaftServiceServer) ForwardApply(context.Context, *ForwardApplyRequest) (*ForwardApplyResponse, error)
func (UnimplementedRaftServiceServer) GetPeerInfo ¶ added in v0.10.2
func (UnimplementedRaftServiceServer) GetPeerInfo(context.Context, *GetPeerInfoRequest) (*GetPeerInfoResponse, error)
func (UnimplementedRaftServiceServer) RemovePeer ¶ added in v0.10.2
func (UnimplementedRaftServiceServer) RemovePeer(context.Context, *RemovePeerRequest) (*RemovePeerResponse, error)
type UnsafeRaftServiceServer ¶
type UnsafeRaftServiceServer interface {
// contains filtered or unexported methods
}
UnsafeRaftServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RaftServiceServer will result in compilation errors.