kv

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Kvstore_Get_FullMethodName    = "/yuhaiin.kvstore.kvstore/Get"
	Kvstore_Set_FullMethodName    = "/yuhaiin.kvstore.kvstore/Set"
	Kvstore_Delete_FullMethodName = "/yuhaiin.kvstore.kvstore/Delete"
	Kvstore_Range_FullMethodName  = "/yuhaiin.kvstore.kvstore/Range"
	Kvstore_Ping_FullMethodName   = "/yuhaiin.kvstore.kvstore/Ping"
)

Variables

View Source
var File_kv_kv_proto protoreflect.FileDescriptor
View Source
var Kvstore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yuhaiin.kvstore.kvstore",
	HandlerType: (*KvstoreServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Get",
			Handler:    _Kvstore_Get_Handler,
		},
		{
			MethodName: "Set",
			Handler:    _Kvstore_Set_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _Kvstore_Delete_Handler,
		},
		{
			MethodName: "Ping",
			Handler:    _Kvstore_Ping_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Range",
			Handler:       _Kvstore_Range_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "kv/kv.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 RegisterKvstoreServer

func RegisterKvstoreServer(s grpc.ServiceRegistrar, srv KvstoreServer)

func Start

func Start(unixPath string, db *bbolt.Cache) (io.Closer, error)

Types

type Element

type Element struct {
	XXX_raceDetectHookData protoimpl.RaceDetectHookData
	XXX_presence           [1]uint32
	// contains filtered or unexported fields
}

func (*Element) ClearKey

func (x *Element) ClearKey()

func (*Element) ClearValue

func (x *Element) ClearValue()

func (*Element) GetBuckets

func (x *Element) GetBuckets() []string

func (*Element) GetKey

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

func (*Element) GetValue

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

func (*Element) HasKey

func (x *Element) HasKey() bool

func (*Element) HasValue

func (x *Element) HasValue() bool

func (*Element) ProtoMessage

func (*Element) ProtoMessage()

func (*Element) ProtoReflect

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

func (*Element) Reset

func (x *Element) Reset()

func (*Element) SetBuckets

func (x *Element) SetBuckets(v []string)

func (*Element) SetKey

func (x *Element) SetKey(v []byte)

func (*Element) SetValue

func (x *Element) SetValue(v []byte)

func (*Element) String

func (x *Element) String() string

type Element_builder

type Element_builder struct {
	Buckets []string
	Key     []byte
	Value   []byte
	// contains filtered or unexported fields
}

func (Element_builder) Build

func (b0 Element_builder) Build() *Element

type KV

type KV struct {
	UnimplementedKvstoreServer
	// contains filtered or unexported fields
}

func NewKV

func NewKV(db *bbolt.Cache) *KV

func (*KV) Delete

func (k *KV) Delete(ctx context.Context, req *Keys) (*emptypb.Empty, error)

func (*KV) Get

func (k *KV) Get(ctx context.Context, e *Element) (*Element, error)

func (*KV) Ping

func (k *KV) Ping(context.Context, *emptypb.Empty) (*emptypb.Empty, error)

func (*KV) Range

func (k *KV) Range(req *Element, s grpc.ServerStreamingServer[Element]) error

func (*KV) Set

func (k *KV) Set(ctx context.Context, e *Element) (*emptypb.Empty, error)

type KVStoreCli

type KVStoreCli struct {
	KvstoreClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(unixPath string) (*KVStoreCli, error)

func (*KVStoreCli) Close

func (c *KVStoreCli) Close() error

func (*KVStoreCli) Delete

func (c *KVStoreCli) Delete(k ...[]byte) error

func (*KVStoreCli) Get

func (c *KVStoreCli) Get(k []byte) ([]byte, error)

func (*KVStoreCli) NewCache

func (c *KVStoreCli) NewCache(b string) cache.RecursionCache

func (*KVStoreCli) Put

func (c *KVStoreCli) Put(k []byte, v []byte) error

func (*KVStoreCli) Range

func (c *KVStoreCli) Range(f func(key []byte, value []byte) bool) error

type Keys

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

func (*Keys) GetBuckets

func (x *Keys) GetBuckets() []string

func (*Keys) GetKeys

func (x *Keys) GetKeys() [][]byte

func (*Keys) ProtoMessage

func (*Keys) ProtoMessage()

func (*Keys) ProtoReflect

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

func (*Keys) Reset

func (x *Keys) Reset()

func (*Keys) SetBuckets

func (x *Keys) SetBuckets(v []string)

func (*Keys) SetKeys

func (x *Keys) SetKeys(v [][]byte)

func (*Keys) String

func (x *Keys) String() string

type Keys_builder

type Keys_builder struct {
	Buckets []string
	Keys    [][]byte
	// contains filtered or unexported fields
}

func (Keys_builder) Build

func (b0 Keys_builder) Build() *Keys

type KvstoreClient

type KvstoreClient interface {
	Get(ctx context.Context, in *Element, opts ...grpc.CallOption) (*Element, error)
	Set(ctx context.Context, in *Element, opts ...grpc.CallOption) (*emptypb.Empty, error)
	Delete(ctx context.Context, in *Keys, opts ...grpc.CallOption) (*emptypb.Empty, error)
	Range(ctx context.Context, in *Element, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Element], error)
	Ping(ctx context.Context, in *emptypb.Empty, 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 {
	Get(context.Context, *Element) (*Element, error)
	Set(context.Context, *Element) (*emptypb.Empty, error)
	Delete(context.Context, *Keys) (*emptypb.Empty, error)
	Range(*Element, grpc.ServerStreamingServer[Element]) error
	Ping(context.Context, *emptypb.Empty) (*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_RangeClient

type Kvstore_RangeClient = grpc.ServerStreamingClient[Element]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Kvstore_RangeServer

type Kvstore_RangeServer = grpc.ServerStreamingServer[Element]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type UnimplementedKvstoreServer

type UnimplementedKvstoreServer struct{}

UnimplementedKvstoreServer 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 (UnimplementedKvstoreServer) Delete

func (UnimplementedKvstoreServer) Get

func (UnimplementedKvstoreServer) Ping

func (UnimplementedKvstoreServer) Range

func (UnimplementedKvstoreServer) Set

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