v0

package
v0.0.0-...-e141e8f Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package v0 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package v0 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package v0 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var ClusterService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dkv.v0.ClusterService",
	HandlerType: (*ClusterServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Status",
			Handler:    _ClusterService_Status_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "dkv/v0/cluster.proto",
}

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

View Source
var File_dkv_v0_cluster_proto protoreflect.FileDescriptor
View Source
var File_dkv_v0_kvstore_proto protoreflect.FileDescriptor
View Source
var File_dkv_v0_replication_proto protoreflect.FileDescriptor
View Source
var KVStore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dkv.v0.KVStore",
	HandlerType: (*KVStoreServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Put",
			Handler:    _KVStore_Put_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _KVStore_Get_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "dkv/v0/kvstore.proto",
}

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

View Source
var Replication_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dkv.v0.Replication",
	HandlerType: (*ReplicationServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Commit",
			Handler:    _Replication_Commit_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "AppendLogs",
			Handler:       _Replication_AppendLogs_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "dkv/v0/replication.proto",
}

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

Functions

func RegisterClusterServiceHandler

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

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

func RegisterClusterServiceHandlerClient

func RegisterClusterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ClusterServiceClient) error

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

func RegisterClusterServiceHandlerFromEndpoint

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

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

func RegisterClusterServiceHandlerServer

func RegisterClusterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ClusterServiceServer) error

RegisterClusterServiceHandlerServer registers the http handlers for service ClusterService to "mux". UnaryRPC :call ClusterServiceServer 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 RegisterClusterServiceHandlerFromEndpoint instead.

func RegisterClusterServiceServer

func RegisterClusterServiceServer(s grpc.ServiceRegistrar, srv ClusterServiceServer)

func RegisterKVStoreHandler

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

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

func RegisterKVStoreHandlerClient

func RegisterKVStoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, client KVStoreClient) error

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

func RegisterKVStoreHandlerFromEndpoint

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

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

func RegisterKVStoreHandlerServer

func RegisterKVStoreHandlerServer(ctx context.Context, mux *runtime.ServeMux, server KVStoreServer) error

RegisterKVStoreHandlerServer registers the http handlers for service KVStore to "mux". UnaryRPC :call KVStoreServer 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 RegisterKVStoreHandlerFromEndpoint instead.

func RegisterKVStoreServer

func RegisterKVStoreServer(s grpc.ServiceRegistrar, srv KVStoreServer)

func RegisterReplicationHandler

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

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

func RegisterReplicationHandlerClient

func RegisterReplicationHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ReplicationClient) error

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

func RegisterReplicationHandlerFromEndpoint

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

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

func RegisterReplicationHandlerServer

func RegisterReplicationHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ReplicationServer) error

RegisterReplicationHandlerServer registers the http handlers for service Replication to "mux". UnaryRPC :call ReplicationServer 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 RegisterReplicationHandlerFromEndpoint instead.

func RegisterReplicationServer

func RegisterReplicationServer(s grpc.ServiceRegistrar, srv ReplicationServer)

Types

type AppendLogRequest

type AppendLogRequest struct {
	Sequence uint64      `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"`
	Msg      *PutRequest `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// contains filtered or unexported fields
}

func (*AppendLogRequest) Descriptor deprecated

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

Deprecated: Use AppendLogRequest.ProtoReflect.Descriptor instead.

func (*AppendLogRequest) GetMsg

func (x *AppendLogRequest) GetMsg() *PutRequest

func (*AppendLogRequest) GetSequence

func (x *AppendLogRequest) GetSequence() uint64

func (*AppendLogRequest) ProtoMessage

func (*AppendLogRequest) ProtoMessage()

func (*AppendLogRequest) ProtoReflect

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

func (*AppendLogRequest) Reset

func (x *AppendLogRequest) Reset()

func (*AppendLogRequest) String

func (x *AppendLogRequest) String() string

type AppendLogsReply

type AppendLogsReply struct {
	LastAppendedSeq uint64 `protobuf:"varint,1,opt,name=last_appended_seq,json=lastAppendedSeq,proto3" json:"last_appended_seq,omitempty"`
	// contains filtered or unexported fields
}

func (*AppendLogsReply) Descriptor deprecated

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

Deprecated: Use AppendLogsReply.ProtoReflect.Descriptor instead.

func (*AppendLogsReply) GetLastAppendedSeq

func (x *AppendLogsReply) GetLastAppendedSeq() uint64

func (*AppendLogsReply) ProtoMessage

func (*AppendLogsReply) ProtoMessage()

func (*AppendLogsReply) ProtoReflect

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

func (*AppendLogsReply) Reset

func (x *AppendLogsReply) Reset()

func (*AppendLogsReply) String

func (x *AppendLogsReply) String() string

type Cluster

type Cluster struct {
	Leader    *Node            `protobuf:"bytes,1,opt,name=leader,proto3" json:"leader,omitempty"`
	Followers map[string]*Node `` /* 159-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Cluster) Descriptor deprecated

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

Deprecated: Use Cluster.ProtoReflect.Descriptor instead.

func (*Cluster) GetFollowers

func (x *Cluster) GetFollowers() map[string]*Node

func (*Cluster) GetLeader

func (x *Cluster) GetLeader() *Node

func (*Cluster) ProtoMessage

func (*Cluster) ProtoMessage()

func (*Cluster) ProtoReflect

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

func (*Cluster) Reset

func (x *Cluster) Reset()

func (*Cluster) String

func (x *Cluster) String() string

type ClusterServiceClient

type ClusterServiceClient interface {
	Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error)
}

ClusterServiceClient is the client API for ClusterService 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 ClusterServiceServer

type ClusterServiceServer interface {
	Status(context.Context, *StatusRequest) (*StatusReply, error)
	// contains filtered or unexported methods
}

ClusterServiceServer is the server API for ClusterService service. All implementations must embed UnimplementedClusterServiceServer for forward compatibility

type CommitReply

type CommitReply struct {
	LastCommittedSeq uint64 `protobuf:"varint,1,opt,name=last_committed_seq,json=lastCommittedSeq,proto3" json:"last_committed_seq,omitempty"`
	// contains filtered or unexported fields
}

func (*CommitReply) Descriptor deprecated

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

Deprecated: Use CommitReply.ProtoReflect.Descriptor instead.

func (*CommitReply) GetLastCommittedSeq

func (x *CommitReply) GetLastCommittedSeq() uint64

func (*CommitReply) ProtoMessage

func (*CommitReply) ProtoMessage()

func (*CommitReply) ProtoReflect

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

func (*CommitReply) Reset

func (x *CommitReply) Reset()

func (*CommitReply) String

func (x *CommitReply) String() string

type CommitRequest

type CommitRequest struct {
	ToSequence uint64 `protobuf:"varint,1,opt,name=to_sequence,json=toSequence,proto3" json:"to_sequence,omitempty"`
	// contains filtered or unexported fields
}

func (*CommitRequest) Descriptor deprecated

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

Deprecated: Use CommitRequest.ProtoReflect.Descriptor instead.

func (*CommitRequest) GetToSequence

func (x *CommitRequest) GetToSequence() uint64

func (*CommitRequest) ProtoMessage

func (*CommitRequest) ProtoMessage()

func (*CommitRequest) ProtoReflect

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

func (*CommitRequest) Reset

func (x *CommitRequest) Reset()

func (*CommitRequest) String

func (x *CommitRequest) String() string

type GetReply

type GetReply struct {
	Key   []byte `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 (*GetReply) Descriptor deprecated

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

Deprecated: Use GetReply.ProtoReflect.Descriptor instead.

func (*GetReply) GetKey

func (x *GetReply) GetKey() []byte

func (*GetReply) GetValue

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

func (*GetReply) ProtoMessage

func (*GetReply) ProtoMessage()

func (*GetReply) ProtoReflect

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

func (*GetReply) Reset

func (x *GetReply) Reset()

func (*GetReply) String

func (x *GetReply) String() string

type GetRequest

type GetRequest struct {
	Key []byte `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() []byte

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 KVStoreClient

type KVStoreClient interface {
	Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutReply, error)
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReply, error)
}

KVStoreClient is the client API for KVStore 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 NewKVStoreClient

func NewKVStoreClient(cc grpc.ClientConnInterface) KVStoreClient

type KVStoreServer

type KVStoreServer interface {
	Put(context.Context, *PutRequest) (*PutReply, error)
	Get(context.Context, *GetRequest) (*GetReply, error)
	// contains filtered or unexported methods
}

KVStoreServer is the server API for KVStore service. All implementations must embed UnimplementedKVStoreServer for forward compatibility

type Node

type Node struct {
	Id   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
	// contains filtered or unexported fields
}

func (*Node) Descriptor deprecated

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

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetAddr

func (x *Node) GetAddr() string

func (*Node) GetId

func (x *Node) GetId() string

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

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

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

type PutReply

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

func (*PutReply) Descriptor deprecated

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

Deprecated: Use PutReply.ProtoReflect.Descriptor instead.

func (*PutReply) GetMessage

func (x *PutReply) GetMessage() string

func (*PutReply) ProtoMessage

func (*PutReply) ProtoMessage()

func (*PutReply) ProtoReflect

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

func (*PutReply) Reset

func (x *PutReply) Reset()

func (*PutReply) String

func (x *PutReply) String() string

type PutRequest

type PutRequest struct {
	Key   []byte `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 (*PutRequest) Descriptor deprecated

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

Deprecated: Use PutRequest.ProtoReflect.Descriptor instead.

func (*PutRequest) GetKey

func (x *PutRequest) GetKey() []byte

func (*PutRequest) GetValue

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

func (*PutRequest) ProtoMessage

func (*PutRequest) ProtoMessage()

func (*PutRequest) ProtoReflect

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

func (*PutRequest) Reset

func (x *PutRequest) Reset()

func (*PutRequest) String

func (x *PutRequest) String() string

type ReplicationClient

type ReplicationClient interface {
	AppendLogs(ctx context.Context, opts ...grpc.CallOption) (Replication_AppendLogsClient, error)
	Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitReply, error)
}

ReplicationClient is the client API for Replication 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 ReplicationServer

type ReplicationServer interface {
	AppendLogs(Replication_AppendLogsServer) error
	Commit(context.Context, *CommitRequest) (*CommitReply, error)
	// contains filtered or unexported methods
}

ReplicationServer is the server API for Replication service. All implementations must embed UnimplementedReplicationServer for forward compatibility

type Replication_AppendLogsClient

type Replication_AppendLogsClient interface {
	Send(*AppendLogRequest) error
	CloseAndRecv() (*AppendLogsReply, error)
	grpc.ClientStream
}

type Replication_AppendLogsServer

type Replication_AppendLogsServer interface {
	SendAndClose(*AppendLogsReply) error
	Recv() (*AppendLogRequest, error)
	grpc.ServerStream
}

type StatusReply

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

func (*StatusReply) Descriptor deprecated

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

Deprecated: Use StatusReply.ProtoReflect.Descriptor instead.

func (*StatusReply) GetCluster

func (x *StatusReply) GetCluster() *Cluster

func (*StatusReply) GetNodeId

func (x *StatusReply) GetNodeId() string

func (*StatusReply) ProtoMessage

func (*StatusReply) ProtoMessage()

func (*StatusReply) ProtoReflect

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

func (*StatusReply) Reset

func (x *StatusReply) Reset()

func (*StatusReply) String

func (x *StatusReply) String() string

type StatusRequest

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

func (*StatusRequest) Descriptor deprecated

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

Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.

func (*StatusRequest) ProtoMessage

func (*StatusRequest) ProtoMessage()

func (*StatusRequest) ProtoReflect

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

func (*StatusRequest) Reset

func (x *StatusRequest) Reset()

func (*StatusRequest) String

func (x *StatusRequest) String() string

type UnimplementedClusterServiceServer

type UnimplementedClusterServiceServer struct {
}

UnimplementedClusterServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedClusterServiceServer) Status

type UnimplementedKVStoreServer

type UnimplementedKVStoreServer struct {
}

UnimplementedKVStoreServer must be embedded to have forward compatible implementations.

func (UnimplementedKVStoreServer) Get

func (UnimplementedKVStoreServer) Put

type UnimplementedReplicationServer

type UnimplementedReplicationServer struct {
}

UnimplementedReplicationServer must be embedded to have forward compatible implementations.

func (UnimplementedReplicationServer) AppendLogs

func (UnimplementedReplicationServer) Commit

type UnsafeClusterServiceServer

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

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

type UnsafeKVStoreServer

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

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

type UnsafeReplicationServer

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

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

Jump to

Keyboard shortcuts

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