kvstorepb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package kvstorepb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

func RegisterKVStoreServer

func RegisterKVStoreServer(s *grpc.Server, srv KVStoreServer)

Types

type DeleteRequest

type DeleteRequest struct {
	Key                  string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteRequest) Descriptor

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

func (*DeleteRequest) GetKey

func (m *DeleteRequest) GetKey() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) Reset

func (m *DeleteRequest) Reset()

func (*DeleteRequest) String

func (m *DeleteRequest) String() string

func (*DeleteRequest) XXX_DiscardUnknown

func (m *DeleteRequest) XXX_DiscardUnknown()

func (*DeleteRequest) XXX_Marshal

func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteRequest) XXX_Merge

func (m *DeleteRequest) XXX_Merge(src proto.Message)

func (*DeleteRequest) XXX_Size

func (m *DeleteRequest) XXX_Size() int

func (*DeleteRequest) XXX_Unmarshal

func (m *DeleteRequest) XXX_Unmarshal(b []byte) error

type DeleteResponse

type DeleteResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteResponse) Descriptor

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

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) Reset

func (m *DeleteResponse) Reset()

func (*DeleteResponse) String

func (m *DeleteResponse) String() string

func (*DeleteResponse) XXX_DiscardUnknown

func (m *DeleteResponse) XXX_DiscardUnknown()

func (*DeleteResponse) XXX_Marshal

func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteResponse) XXX_Merge

func (m *DeleteResponse) XXX_Merge(src proto.Message)

func (*DeleteResponse) XXX_Size

func (m *DeleteResponse) XXX_Size() int

func (*DeleteResponse) XXX_Unmarshal

func (m *DeleteResponse) XXX_Unmarshal(b []byte) error

type GetPrefixRequest

type GetPrefixRequest struct {
	// keys: [not_match, match_1, match_2, match.3, match@4]
	// match: [match_1, match_2, match.3, match@4]
	// match_: [match_1,, match_2]
	// match@: [match@3]
	// match!: []
	KeyPrefix            string   `protobuf:"bytes,1,opt,name=key_prefix,json=keyPrefix,proto3" json:"key_prefix,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetPrefixRequest) Descriptor

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

func (*GetPrefixRequest) GetKeyPrefix

func (m *GetPrefixRequest) GetKeyPrefix() string

func (*GetPrefixRequest) ProtoMessage

func (*GetPrefixRequest) ProtoMessage()

func (*GetPrefixRequest) Reset

func (m *GetPrefixRequest) Reset()

func (*GetPrefixRequest) String

func (m *GetPrefixRequest) String() string

func (*GetPrefixRequest) XXX_DiscardUnknown

func (m *GetPrefixRequest) XXX_DiscardUnknown()

func (*GetPrefixRequest) XXX_Marshal

func (m *GetPrefixRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetPrefixRequest) XXX_Merge

func (m *GetPrefixRequest) XXX_Merge(src proto.Message)

func (*GetPrefixRequest) XXX_Size

func (m *GetPrefixRequest) XXX_Size() int

func (*GetPrefixRequest) XXX_Unmarshal

func (m *GetPrefixRequest) XXX_Unmarshal(b []byte) error

type GetPrefixResponse

type GetPrefixResponse struct {
	Matches              []*GetPrefixResponse_Match `protobuf:"bytes,1,rep,name=matches,proto3" json:"matches,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                   `json:"-"`
	XXX_unrecognized     []byte                     `json:"-"`
	XXX_sizecache        int32                      `json:"-"`
}

func (*GetPrefixResponse) Descriptor

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

func (*GetPrefixResponse) GetMatches

func (m *GetPrefixResponse) GetMatches() []*GetPrefixResponse_Match

func (*GetPrefixResponse) ProtoMessage

func (*GetPrefixResponse) ProtoMessage()

func (*GetPrefixResponse) Reset

func (m *GetPrefixResponse) Reset()

func (*GetPrefixResponse) String

func (m *GetPrefixResponse) String() string

func (*GetPrefixResponse) XXX_DiscardUnknown

func (m *GetPrefixResponse) XXX_DiscardUnknown()

func (*GetPrefixResponse) XXX_Marshal

func (m *GetPrefixResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetPrefixResponse) XXX_Merge

func (m *GetPrefixResponse) XXX_Merge(src proto.Message)

func (*GetPrefixResponse) XXX_Size

func (m *GetPrefixResponse) XXX_Size() int

func (*GetPrefixResponse) XXX_Unmarshal

func (m *GetPrefixResponse) XXX_Unmarshal(b []byte) error

type GetPrefixResponse_Match

type GetPrefixResponse_Match 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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetPrefixResponse_Match) Descriptor

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

func (*GetPrefixResponse_Match) GetKey

func (m *GetPrefixResponse_Match) GetKey() string

func (*GetPrefixResponse_Match) GetValue

func (m *GetPrefixResponse_Match) GetValue() []byte

func (*GetPrefixResponse_Match) ProtoMessage

func (*GetPrefixResponse_Match) ProtoMessage()

func (*GetPrefixResponse_Match) Reset

func (m *GetPrefixResponse_Match) Reset()

func (*GetPrefixResponse_Match) String

func (m *GetPrefixResponse_Match) String() string

func (*GetPrefixResponse_Match) XXX_DiscardUnknown

func (m *GetPrefixResponse_Match) XXX_DiscardUnknown()

func (*GetPrefixResponse_Match) XXX_Marshal

func (m *GetPrefixResponse_Match) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetPrefixResponse_Match) XXX_Merge

func (m *GetPrefixResponse_Match) XXX_Merge(src proto.Message)

func (*GetPrefixResponse_Match) XXX_Size

func (m *GetPrefixResponse_Match) XXX_Size() int

func (*GetPrefixResponse_Match) XXX_Unmarshal

func (m *GetPrefixResponse_Match) XXX_Unmarshal(b []byte) error

type GetPrefixStreamRequest

type GetPrefixStreamRequest struct {
	// keys: [not_match, match_1, match_2, match.3, match@4]
	// match: [match_1, match_2, match.3, match@4]
	// match_: [match_1,, match_2]
	// match@: [match@3]
	// match!: []
	KeyPrefix            string   `protobuf:"bytes,1,opt,name=key_prefix,json=keyPrefix,proto3" json:"key_prefix,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetPrefixStreamRequest) Descriptor

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

func (*GetPrefixStreamRequest) GetKeyPrefix

func (m *GetPrefixStreamRequest) GetKeyPrefix() string

func (*GetPrefixStreamRequest) ProtoMessage

func (*GetPrefixStreamRequest) ProtoMessage()

func (*GetPrefixStreamRequest) Reset

func (m *GetPrefixStreamRequest) Reset()

func (*GetPrefixStreamRequest) String

func (m *GetPrefixStreamRequest) String() string

func (*GetPrefixStreamRequest) XXX_DiscardUnknown

func (m *GetPrefixStreamRequest) XXX_DiscardUnknown()

func (*GetPrefixStreamRequest) XXX_Marshal

func (m *GetPrefixStreamRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetPrefixStreamRequest) XXX_Merge

func (m *GetPrefixStreamRequest) XXX_Merge(src proto.Message)

func (*GetPrefixStreamRequest) XXX_Size

func (m *GetPrefixStreamRequest) XXX_Size() int

func (*GetPrefixStreamRequest) XXX_Unmarshal

func (m *GetPrefixStreamRequest) XXX_Unmarshal(b []byte) error

type GetPrefixStreamResponse

type GetPrefixStreamResponse 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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetPrefixStreamResponse) Descriptor

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

func (*GetPrefixStreamResponse) GetKey

func (m *GetPrefixStreamResponse) GetKey() string

func (*GetPrefixStreamResponse) GetValue

func (m *GetPrefixStreamResponse) GetValue() []byte

func (*GetPrefixStreamResponse) ProtoMessage

func (*GetPrefixStreamResponse) ProtoMessage()

func (*GetPrefixStreamResponse) Reset

func (m *GetPrefixStreamResponse) Reset()

func (*GetPrefixStreamResponse) String

func (m *GetPrefixStreamResponse) String() string

func (*GetPrefixStreamResponse) XXX_DiscardUnknown

func (m *GetPrefixStreamResponse) XXX_DiscardUnknown()

func (*GetPrefixStreamResponse) XXX_Marshal

func (m *GetPrefixStreamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetPrefixStreamResponse) XXX_Merge

func (m *GetPrefixStreamResponse) XXX_Merge(src proto.Message)

func (*GetPrefixStreamResponse) XXX_Size

func (m *GetPrefixStreamResponse) XXX_Size() int

func (*GetPrefixStreamResponse) XXX_Unmarshal

func (m *GetPrefixStreamResponse) XXX_Unmarshal(b []byte) error

type GetRequest

type GetRequest struct {
	Key                  string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetRequest) Descriptor

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

func (*GetRequest) GetKey

func (m *GetRequest) GetKey() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) Reset

func (m *GetRequest) Reset()

func (*GetRequest) String

func (m *GetRequest) String() string

func (*GetRequest) XXX_DiscardUnknown

func (m *GetRequest) XXX_DiscardUnknown()

func (*GetRequest) XXX_Marshal

func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetRequest) XXX_Merge

func (m *GetRequest) XXX_Merge(src proto.Message)

func (*GetRequest) XXX_Size

func (m *GetRequest) XXX_Size() int

func (*GetRequest) XXX_Unmarshal

func (m *GetRequest) XXX_Unmarshal(b []byte) error

type GetResponse

type GetResponse struct {
	Value                []byte   `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetResponse) Descriptor

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

func (*GetResponse) GetValue

func (m *GetResponse) GetValue() []byte

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) Reset

func (m *GetResponse) Reset()

func (*GetResponse) String

func (m *GetResponse) String() string

func (*GetResponse) XXX_DiscardUnknown

func (m *GetResponse) XXX_DiscardUnknown()

func (*GetResponse) XXX_Marshal

func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetResponse) XXX_Merge

func (m *GetResponse) XXX_Merge(src proto.Message)

func (*GetResponse) XXX_Size

func (m *GetResponse) XXX_Size() int

func (*GetResponse) XXX_Unmarshal

func (m *GetResponse) XXX_Unmarshal(b []byte) error

type KVStoreClient

type KVStoreClient interface {
	// Put 创建kv键值对
	// 若key已存在将更新value值
	Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error)
	// Get 获取key的value
	// 若key不存在则返回gRPC错误:NotFound
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
	// GetPrefix 获取符合key_prefix的多个kv键值对
	GetPrefix(ctx context.Context, in *GetPrefixRequest, opts ...grpc.CallOption) (*GetPrefixResponse, error)
	// GetPrefixStream gRPC stream方式获取符合key_prefix的多个kv键值对
	GetPrefixStream(ctx context.Context, in *GetPrefixStreamRequest, opts ...grpc.CallOption) (KVStore_GetPrefixStreamClient, error)
	// Delete 删除kv键值对
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
}

KVStoreClient is the client API for KVStore service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewKVStoreClient

func NewKVStoreClient(cc grpc.ClientConnInterface) KVStoreClient

type KVStoreServer

type KVStoreServer interface {
	// Put 创建kv键值对
	// 若key已存在将更新value值
	Put(context.Context, *PutRequest) (*PutResponse, error)
	// Get 获取key的value
	// 若key不存在则返回gRPC错误:NotFound
	Get(context.Context, *GetRequest) (*GetResponse, error)
	// GetPrefix 获取符合key_prefix的多个kv键值对
	GetPrefix(context.Context, *GetPrefixRequest) (*GetPrefixResponse, error)
	// GetPrefixStream gRPC stream方式获取符合key_prefix的多个kv键值对
	GetPrefixStream(*GetPrefixStreamRequest, KVStore_GetPrefixStreamServer) error
	// Delete 删除kv键值对
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
}

KVStoreServer is the server API for KVStore service.

type KVStore_GetPrefixStreamClient

type KVStore_GetPrefixStreamClient interface {
	Recv() (*GetPrefixStreamResponse, error)
	grpc.ClientStream
}

type KVStore_GetPrefixStreamServer

type KVStore_GetPrefixStreamServer interface {
	Send(*GetPrefixStreamResponse) error
	grpc.ServerStream
}

type PutRequest

type PutRequest 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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PutRequest) Descriptor

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

func (*PutRequest) GetKey

func (m *PutRequest) GetKey() string

func (*PutRequest) GetValue

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

func (*PutRequest) ProtoMessage

func (*PutRequest) ProtoMessage()

func (*PutRequest) Reset

func (m *PutRequest) Reset()

func (*PutRequest) String

func (m *PutRequest) String() string

func (*PutRequest) XXX_DiscardUnknown

func (m *PutRequest) XXX_DiscardUnknown()

func (*PutRequest) XXX_Marshal

func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PutRequest) XXX_Merge

func (m *PutRequest) XXX_Merge(src proto.Message)

func (*PutRequest) XXX_Size

func (m *PutRequest) XXX_Size() int

func (*PutRequest) XXX_Unmarshal

func (m *PutRequest) XXX_Unmarshal(b []byte) error

type PutResponse

type PutResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PutResponse) Descriptor

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

func (*PutResponse) ProtoMessage

func (*PutResponse) ProtoMessage()

func (*PutResponse) Reset

func (m *PutResponse) Reset()

func (*PutResponse) String

func (m *PutResponse) String() string

func (*PutResponse) XXX_DiscardUnknown

func (m *PutResponse) XXX_DiscardUnknown()

func (*PutResponse) XXX_Marshal

func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PutResponse) XXX_Merge

func (m *PutResponse) XXX_Merge(src proto.Message)

func (*PutResponse) XXX_Size

func (m *PutResponse) XXX_Size() int

func (*PutResponse) XXX_Unmarshal

func (m *PutResponse) XXX_Unmarshal(b []byte) error

type UnimplementedKVStoreServer

type UnimplementedKVStoreServer struct {
}

UnimplementedKVStoreServer can be embedded to have forward compatible implementations.

func (*UnimplementedKVStoreServer) Delete

func (*UnimplementedKVStoreServer) Get

func (*UnimplementedKVStoreServer) GetPrefix

func (*UnimplementedKVStoreServer) GetPrefixStream

func (*UnimplementedKVStoreServer) Put

Jump to

Keyboard shortcuts

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