proto

package module
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	CacheService_Put_FullMethodName                 = "/cache.CacheService/Put"
	CacheService_PutObject_FullMethodName           = "/cache.CacheService/PutObject"
	CacheService_Get_FullMethodName                 = "/cache.CacheService/Get"
	CacheService_Delete_FullMethodName              = "/cache.CacheService/Delete"
	CacheService_List_FullMethodName                = "/cache.CacheService/List"
	CacheService_ListLocal_FullMethodName           = "/cache.CacheService/ListLocal"
	CacheService_ListWithValues_FullMethodName      = "/cache.CacheService/ListWithValues"
	CacheService_ListLocalWithValues_FullMethodName = "/cache.CacheService/ListLocalWithValues"
	CacheService_GetTopology_FullMethodName         = "/cache.CacheService/GetTopology"
)

Variables

View Source
var CacheService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cache.CacheService",
	HandlerType: (*CacheServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "PutObject",
			Handler:    _CacheService_PutObject_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _CacheService_Delete_Handler,
		},
		{
			MethodName: "List",
			Handler:    _CacheService_List_Handler,
		},
		{
			MethodName: "ListLocal",
			Handler:    _CacheService_ListLocal_Handler,
		},
		{
			MethodName: "ListWithValues",
			Handler:    _CacheService_ListWithValues_Handler,
		},
		{
			MethodName: "ListLocalWithValues",
			Handler:    _CacheService_ListLocalWithValues_Handler,
		},
		{
			MethodName: "GetTopology",
			Handler:    _CacheService_GetTopology_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Put",
			Handler:       _CacheService_Put_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "Get",
			Handler:       _CacheService_Get_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "cache.proto",
}

CacheService_ServiceDesc is the grpc.ServiceDesc for CacheService 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_cache_proto protoreflect.FileDescriptor

Functions

func RegisterCacheServiceHandler

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

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

func RegisterCacheServiceHandlerClient

func RegisterCacheServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CacheServiceClient) error

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

func RegisterCacheServiceHandlerFromEndpoint

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

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

func RegisterCacheServiceHandlerServer

func RegisterCacheServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CacheServiceServer) error

RegisterCacheServiceHandlerServer registers the http handlers for service CacheService to "mux". UnaryRPC :call CacheServiceServer 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 RegisterCacheServiceHandlerFromEndpoint 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 RegisterCacheServiceServer

func RegisterCacheServiceServer(s grpc.ServiceRegistrar, srv CacheServiceServer)

Types

type CacheServiceClient

type CacheServiceClient interface {
	Put(ctx context.Context, opts ...grpc.CallOption) (CacheService_PutClient, error)
	PutObject(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error)
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (CacheService_GetClient, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
	// ListLocal is an internal RPC for cluster mode: queries local node only
	// Returns sorted, paginated keys from this node's storage
	ListLocal(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
	ListWithValues(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListWithValuesResponse, error)
	// ListLocalWithValues is an internal RPC for cluster mode: queries local node only
	// Returns sorted, paginated key-value pairs from this node's storage
	ListLocalWithValues(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListWithValuesResponse, error)
	GetTopology(ctx context.Context, in *GetTopologyRequest, opts ...grpc.CallOption) (*GetTopologyResponse, error)
}

CacheServiceClient is the client API for CacheService 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 CacheServiceServer

type CacheServiceServer interface {
	Put(CacheService_PutServer) error
	PutObject(context.Context, *PutRequest) (*PutResponse, error)
	Get(*GetRequest, CacheService_GetServer) error
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	List(context.Context, *ListRequest) (*ListResponse, error)
	// ListLocal is an internal RPC for cluster mode: queries local node only
	// Returns sorted, paginated keys from this node's storage
	ListLocal(context.Context, *ListRequest) (*ListResponse, error)
	ListWithValues(context.Context, *ListRequest) (*ListWithValuesResponse, error)
	// ListLocalWithValues is an internal RPC for cluster mode: queries local node only
	// Returns sorted, paginated key-value pairs from this node's storage
	ListLocalWithValues(context.Context, *ListRequest) (*ListWithValuesResponse, error)
	GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error)
	// contains filtered or unexported methods
}

CacheServiceServer is the server API for CacheService service. All implementations must embed UnimplementedCacheServiceServer for forward compatibility

type CacheService_GetClient

type CacheService_GetClient interface {
	Recv() (*GetResponse, error)
	grpc.ClientStream
}

type CacheService_GetServer

type CacheService_GetServer interface {
	Send(*GetResponse) error
	grpc.ServerStream
}

type CacheService_PutClient

type CacheService_PutClient interface {
	Send(*PutRequest) error
	CloseAndRecv() (*PutResponse, error)
	grpc.ClientStream
}

type CacheService_PutServer

type CacheService_PutServer interface {
	SendAndClose(*PutResponse) error
	Recv() (*PutRequest, error)
	grpc.ServerStream
}

type DeleteRequest

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

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 DeleteResponse

type DeleteResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	Error   string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteResponse) Descriptor deprecated

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

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) GetError

func (x *DeleteResponse) GetError() string

func (*DeleteResponse) GetSuccess

func (x *DeleteResponse) GetSuccess() bool

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

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

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type GetRequest

type GetRequest struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Start int64  `protobuf:"varint,2,opt,name=start,proto3" json:"start,omitempty"` // inclusive byte offset in the object (0-based)
	End   int64  `protobuf:"varint,3,opt,name=end,proto3" json:"end,omitempty"`     // inclusive byte offset (if 0 or omitted, read to EOF)
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetEnd

func (x *GetRequest) GetEnd() int64

func (*GetRequest) GetKey

func (x *GetRequest) GetKey() string

func (*GetRequest) GetStart

func (x *GetRequest) GetStart() int64

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 GetResponse

type GetResponse struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResponse) Descriptor deprecated

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

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetData

func (x *GetResponse) GetData() []byte

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect

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

func (*GetResponse) Reset

func (x *GetResponse) Reset()

func (*GetResponse) String

func (x *GetResponse) String() string

type GetTopologyRequest

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

func (*GetTopologyRequest) Descriptor deprecated

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

Deprecated: Use GetTopologyRequest.ProtoReflect.Descriptor instead.

func (*GetTopologyRequest) ProtoMessage

func (*GetTopologyRequest) ProtoMessage()

func (*GetTopologyRequest) ProtoReflect

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

func (*GetTopologyRequest) Reset

func (x *GetTopologyRequest) Reset()

func (*GetTopologyRequest) String

func (x *GetTopologyRequest) String() string

type GetTopologyResponse

type GetTopologyResponse struct {
	Topology *proto.ClusterTopology `protobuf:"bytes,1,opt,name=topology,proto3" json:"topology,omitempty"` // Reuse ClusterTopology from cluster.proto
	Error    string                 `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`       // non-empty if error occurred (e.g., cluster mode not enabled)
	// contains filtered or unexported fields
}

func (*GetTopologyResponse) Descriptor deprecated

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

Deprecated: Use GetTopologyResponse.ProtoReflect.Descriptor instead.

func (*GetTopologyResponse) GetError

func (x *GetTopologyResponse) GetError() string

func (*GetTopologyResponse) GetTopology

func (x *GetTopologyResponse) GetTopology() *proto.ClusterTopology

func (*GetTopologyResponse) ProtoMessage

func (*GetTopologyResponse) ProtoMessage()

func (*GetTopologyResponse) ProtoReflect

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

func (*GetTopologyResponse) Reset

func (x *GetTopologyResponse) Reset()

func (*GetTopologyResponse) String

func (x *GetTopologyResponse) String() string

type KeyValue

type KeyValue 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"`
	ValueLength  int64  `protobuf:"varint,3,opt,name=value_length,json=valueLength,proto3" json:"value_length,omitempty"`    // Size of the value in bytes (set even when value is omitted)
	ValueOmitted bool   `protobuf:"varint,4,opt,name=value_omitted,json=valueOmitted,proto3" json:"value_omitted,omitempty"` // True if the value was omitted because it exceeds the List value-size cap
	// 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() []byte

func (*KeyValue) GetValueLength

func (x *KeyValue) GetValueLength() int64

func (*KeyValue) GetValueOmitted

func (x *KeyValue) GetValueOmitted() bool

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 ListRequest

type ListRequest struct {
	Prefix            string `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"`                                                // Optional prefix to filter keys
	StartKey          string `protobuf:"bytes,2,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"`                            // Start listing after this key (exclusive), for pagination
	Limit             int32  `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`                                                 // Maximum number of keys to return (default 1000, max 1000)
	ContinuationToken string `protobuf:"bytes,4,opt,name=continuation_token,json=continuationToken,proto3" json:"continuation_token,omitempty"` // Opaque token for resuming pagination
	// contains filtered or unexported fields
}

func (*ListRequest) Descriptor deprecated

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

Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.

func (*ListRequest) GetContinuationToken

func (x *ListRequest) GetContinuationToken() string

func (*ListRequest) GetLimit

func (x *ListRequest) GetLimit() int32

func (*ListRequest) GetPrefix

func (x *ListRequest) GetPrefix() string

func (*ListRequest) GetStartKey

func (x *ListRequest) GetStartKey() string

func (*ListRequest) ProtoMessage

func (*ListRequest) ProtoMessage()

func (*ListRequest) ProtoReflect

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

func (*ListRequest) Reset

func (x *ListRequest) Reset()

func (*ListRequest) String

func (x *ListRequest) String() string

type ListResponse

type ListResponse struct {
	Keys              []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
	ContinuationToken string   `protobuf:"bytes,2,opt,name=continuation_token,json=continuationToken,proto3" json:"continuation_token,omitempty"` // Token to resume listing from where this response ended
	HasMore           bool     `protobuf:"varint,3,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"`                              // True if more keys are available beyond this page
	// contains filtered or unexported fields
}

func (*ListResponse) Descriptor deprecated

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

Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.

func (*ListResponse) GetContinuationToken

func (x *ListResponse) GetContinuationToken() string

func (*ListResponse) GetHasMore

func (x *ListResponse) GetHasMore() bool

func (*ListResponse) GetKeys

func (x *ListResponse) GetKeys() []string

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) ProtoReflect

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

func (*ListResponse) Reset

func (x *ListResponse) Reset()

func (*ListResponse) String

func (x *ListResponse) String() string

type ListWithValuesResponse

type ListWithValuesResponse struct {
	Entries           []*KeyValue `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	ContinuationToken string      `protobuf:"bytes,2,opt,name=continuation_token,json=continuationToken,proto3" json:"continuation_token,omitempty"` // Token to resume listing from where this response ended
	HasMore           bool        `protobuf:"varint,3,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"`                              // True if more entries are available beyond this page
	// contains filtered or unexported fields
}

func (*ListWithValuesResponse) Descriptor deprecated

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

Deprecated: Use ListWithValuesResponse.ProtoReflect.Descriptor instead.

func (*ListWithValuesResponse) GetContinuationToken

func (x *ListWithValuesResponse) GetContinuationToken() string

func (*ListWithValuesResponse) GetEntries

func (x *ListWithValuesResponse) GetEntries() []*KeyValue

func (*ListWithValuesResponse) GetHasMore

func (x *ListWithValuesResponse) GetHasMore() bool

func (*ListWithValuesResponse) ProtoMessage

func (*ListWithValuesResponse) ProtoMessage()

func (*ListWithValuesResponse) ProtoReflect

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

func (*ListWithValuesResponse) Reset

func (x *ListWithValuesResponse) Reset()

func (*ListWithValuesResponse) String

func (x *ListWithValuesResponse) String() string

type PutRequest

type PutRequest struct {
	Key        string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`                                  // the cache key; only required in the first message
	TtlSeconds int64  `protobuf:"varint,2,opt,name=ttl_seconds,json=ttlSeconds,proto3" json:"ttl_seconds,omitempty"` // optional TTL; only used in the first message
	Data       []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`                                // raw chunk of the object
	// contains filtered or unexported fields
}

func (*PutRequest) Descriptor deprecated

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

Deprecated: Use PutRequest.ProtoReflect.Descriptor instead.

func (*PutRequest) GetData

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

func (*PutRequest) GetKey

func (x *PutRequest) GetKey() string

func (*PutRequest) GetTtlSeconds

func (x *PutRequest) GetTtlSeconds() int64

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 PutResponse

type PutResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	Error   string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // nonempty if something went wrong
	// contains filtered or unexported fields
}

func (*PutResponse) Descriptor deprecated

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

Deprecated: Use PutResponse.ProtoReflect.Descriptor instead.

func (*PutResponse) GetError

func (x *PutResponse) GetError() string

func (*PutResponse) GetSuccess

func (x *PutResponse) GetSuccess() bool

func (*PutResponse) ProtoMessage

func (*PutResponse) ProtoMessage()

func (*PutResponse) ProtoReflect

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

func (*PutResponse) Reset

func (x *PutResponse) Reset()

func (*PutResponse) String

func (x *PutResponse) String() string

type UnimplementedCacheServiceServer

type UnimplementedCacheServiceServer struct {
}

UnimplementedCacheServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedCacheServiceServer) Delete

func (UnimplementedCacheServiceServer) Get

func (UnimplementedCacheServiceServer) GetTopology

func (UnimplementedCacheServiceServer) List

func (UnimplementedCacheServiceServer) ListLocal

func (UnimplementedCacheServiceServer) ListLocalWithValues

func (UnimplementedCacheServiceServer) ListWithValues

func (UnimplementedCacheServiceServer) Put

func (UnimplementedCacheServiceServer) PutObject

type UnsafeCacheServiceServer

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

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

Jump to

Keyboard shortcuts

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