kvstore

package
v0.69.94 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package kvstore is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	KvStore_Scan_FullMethodName   = "/blueapi.kvstore.v1.KvStore/Scan"
	KvStore_Read_FullMethodName   = "/blueapi.kvstore.v1.KvStore/Read"
	KvStore_Write_FullMethodName  = "/blueapi.kvstore.v1.KvStore/Write"
	KvStore_Delete_FullMethodName = "/blueapi.kvstore.v1.KvStore/Delete"
)

Variables

View Source
var File_kvstore_v1_kvstore_proto protoreflect.FileDescriptor
View Source
var KvStore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "blueapi.kvstore.v1.KvStore",
	HandlerType: (*KvStoreServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Read",
			Handler:    _KvStore_Read_Handler,
		},
		{
			MethodName: "Write",
			Handler:    _KvStore_Write_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _KvStore_Delete_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Scan",
			Handler:       _KvStore_Scan_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "kvstore/v1/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)

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. 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)

Types

type DeleteRequest

type DeleteRequest struct {

	// Required. The key to delete. To delete all keys, set this to `-` (hyphen).
	// You can also prefix this with `like:` which translates to SQL's LIKE operator.
	// For example, `like:%pattern%`.
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

Request message for the KvStore.Delete rpc.

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetKey

func (x *DeleteRequest) GetKey() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type KeyValue

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

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

Deprecated: Use KeyValue.ProtoReflect.Descriptor instead.

func (*KeyValue) GetKey

func (x *KeyValue) GetKey() string

func (*KeyValue) GetValue

func (x *KeyValue) GetValue() string

func (*KeyValue) ProtoMessage

func (*KeyValue) ProtoMessage()

func (*KeyValue) ProtoReflect

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

func (*KeyValue) Reset

func (x *KeyValue) Reset()

func (*KeyValue) String

func (x *KeyValue) String() string

type KvStoreClient

type KvStoreClient interface {
	// Scans key:value data from your store.
	Scan(ctx context.Context, in *ScanRequest, opts ...grpc.CallOption) (KvStore_ScanClient, error)
	// Reads a key:value data from your store.
	Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*KeyValue, error)
	// Writes a new (or update an existing) key:value data in your store.
	Write(ctx context.Context, in *KeyValue, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Deletes a key:value data from your store.
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, 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 {
	// Scans key:value data from your store.
	Scan(*ScanRequest, KvStore_ScanServer) error
	// Reads a key:value data from your store.
	Read(context.Context, *ReadRequest) (*KeyValue, error)
	// Writes a new (or update an existing) key:value data in your store.
	Write(context.Context, *KeyValue) (*emptypb.Empty, error)
	// Deletes a key:value data from your store.
	Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

KvStoreServer is the server API for KvStore service. All implementations must embed UnimplementedKvStoreServer for forward compatibility

type KvStore_ScanClient

type KvStore_ScanClient interface {
	Recv() (*KeyValue, error)
	grpc.ClientStream
}

type KvStore_ScanServer

type KvStore_ScanServer interface {
	Send(*KeyValue) error
	grpc.ServerStream
}

type ReadRequest

type ReadRequest struct {

	// Required. The key to read.
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

Request message for the KvStore.Read rpc.

func (*ReadRequest) Descriptor deprecated

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

Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.

func (*ReadRequest) GetKey

func (x *ReadRequest) GetKey() string

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) ProtoReflect

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

func (*ReadRequest) Reset

func (x *ReadRequest) Reset()

func (*ReadRequest) String

func (x *ReadRequest) String() string

type ScanRequest

type ScanRequest struct {

	// Optional. If non-empty, translates to SQL's `LIKE` operand.
	// Return all keys by default.
	Like string `protobuf:"bytes,1,opt,name=like,proto3" json:"like,omitempty"`
	// contains filtered or unexported fields
}

Request message for the KvStore.Scan rpc.

func (*ScanRequest) Descriptor deprecated

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

Deprecated: Use ScanRequest.ProtoReflect.Descriptor instead.

func (*ScanRequest) GetLike

func (x *ScanRequest) GetLike() string

func (*ScanRequest) ProtoMessage

func (*ScanRequest) ProtoMessage()

func (*ScanRequest) ProtoReflect

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

func (*ScanRequest) Reset

func (x *ScanRequest) Reset()

func (*ScanRequest) String

func (x *ScanRequest) String() string

type UnimplementedKvStoreServer

type UnimplementedKvStoreServer struct {
}

UnimplementedKvStoreServer must be embedded to have forward compatible implementations.

func (UnimplementedKvStoreServer) Delete

func (UnimplementedKvStoreServer) Read

func (UnimplementedKvStoreServer) Scan

func (UnimplementedKvStoreServer) Write

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.

Jump to

Keyboard shortcuts

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