Documentation
¶
Overview ¶
Package persistence is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterStorageServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterStorageServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StorageServiceClient) error
- func RegisterStorageServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterStorageServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StorageServiceServer) error
- func RegisterStorageServiceServer(s grpc.ServiceRegistrar, srv StorageServiceServer)
- type GetRequest
- type GetResponse
- type Key
- func (*Key) Descriptor() ([]byte, []int)deprecated
- func (x *Key) GetPlayerKey() *PlayerKey
- func (x *Key) GetTitleKey() *TitleKey
- func (x *Key) GetTypedKey() isKey_TypedKey
- func (*Key) ProtoMessage()
- func (x *Key) ProtoReflect() protoreflect.Message
- func (x *Key) Reset()
- func (x *Key) String() string
- type Key_PlayerKey
- type Key_TitleKey
- type PlayerKey
- func (*PlayerKey) Descriptor() ([]byte, []int)deprecated
- func (x *PlayerKey) GetDatatype() string
- func (x *PlayerKey) GetPlayerId() string
- func (x *PlayerKey) GetTitleId() string
- func (*PlayerKey) ProtoMessage()
- func (x *PlayerKey) ProtoReflect() protoreflect.Message
- func (x *PlayerKey) Reset()
- func (x *PlayerKey) String() string
- type SetRequest
- type SetResponse
- type StorageServiceClient
- type StorageServiceServer
- type StorageService_UpdateClient
- type StorageService_UpdateServer
- type StorageService_WatchClient
- type StorageService_WatchServer
- type TitleKey
- type UnimplementedStorageServiceServer
- func (UnimplementedStorageServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error)
- func (UnimplementedStorageServiceServer) Set(context.Context, *SetRequest) (*SetResponse, error)
- func (UnimplementedStorageServiceServer) Update(grpc.BidiStreamingServer[UpdateRequest, UpdateResponse]) error
- func (UnimplementedStorageServiceServer) Watch(*WatchRequest, grpc.ServerStreamingServer[WatchResponse]) error
- type UnsafeStorageServiceServer
- type UpdateRequest
- func (*UpdateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateRequest) GetGet() *GetRequest
- func (x *UpdateRequest) GetRequestType() isUpdateRequest_RequestType
- func (x *UpdateRequest) GetSet() *SetRequest
- func (*UpdateRequest) ProtoMessage()
- func (x *UpdateRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateRequest) Reset()
- func (x *UpdateRequest) String() string
- type UpdateRequest_Get
- type UpdateRequest_Set
- type UpdateResponse
- func (*UpdateResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateResponse) GetGet() *GetResponse
- func (x *UpdateResponse) GetResponseType() isUpdateResponse_ResponseType
- func (x *UpdateResponse) GetSet() *SetResponse
- func (*UpdateResponse) ProtoMessage()
- func (x *UpdateResponse) ProtoReflect() protoreflect.Message
- func (x *UpdateResponse) Reset()
- func (x *UpdateResponse) String() string
- type UpdateResponse_Get
- type UpdateResponse_Set
- type WatchRequest
- type WatchResponse
Constants ¶
const ( StorageService_Get_FullMethodName = "/bricks.v1.persistence.StorageService/Get" StorageService_Set_FullMethodName = "/bricks.v1.persistence.StorageService/Set" StorageService_Watch_FullMethodName = "/bricks.v1.persistence.StorageService/Watch" StorageService_Update_FullMethodName = "/bricks.v1.persistence.StorageService/Update" )
Variables ¶
var File_bricks_v1_persistence_storage_proto protoreflect.FileDescriptor
var StorageService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "bricks.v1.persistence.StorageService", HandlerType: (*StorageServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Get", Handler: _StorageService_Get_Handler, }, { MethodName: "Set", Handler: _StorageService_Set_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Watch", Handler: _StorageService_Watch_Handler, ServerStreams: true, }, { StreamName: "Update", Handler: _StorageService_Update_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "bricks/v1/persistence/storage.proto", }
StorageService_ServiceDesc is the grpc.ServiceDesc for StorageService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterStorageServiceHandler ¶ added in v0.20.0
func RegisterStorageServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterStorageServiceHandler registers the http handlers for service StorageService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterStorageServiceHandlerClient ¶ added in v0.20.0
func RegisterStorageServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StorageServiceClient) error
RegisterStorageServiceHandlerClient registers the http handlers for service StorageService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "StorageServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "StorageServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "StorageServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterStorageServiceHandlerFromEndpoint ¶ added in v0.20.0
func RegisterStorageServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterStorageServiceHandlerFromEndpoint is same as RegisterStorageServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterStorageServiceHandlerServer ¶ added in v0.20.0
func RegisterStorageServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StorageServiceServer) error
RegisterStorageServiceHandlerServer registers the http handlers for service StorageService to "mux". UnaryRPC :call StorageServiceServer 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 RegisterStorageServiceHandlerFromEndpoint 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 RegisterStorageServiceServer ¶
func RegisterStorageServiceServer(s grpc.ServiceRegistrar, srv StorageServiceServer)
Types ¶
type GetRequest ¶
type GetRequest struct {
Key *Key `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() *Key
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 {
Value *structpb.Struct `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*GetResponse) Descriptor
deprecated
func (*GetResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.
func (*GetResponse) GetValue ¶
func (x *GetResponse) GetValue() *structpb.Struct
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 Key ¶
type Key struct {
// Types that are valid to be assigned to TypedKey:
//
// *Key_PlayerKey
// *Key_TitleKey
TypedKey isKey_TypedKey `protobuf_oneof:"typed_key"`
// contains filtered or unexported fields
}
func (*Key) Descriptor
deprecated
func (*Key) GetPlayerKey ¶
func (*Key) GetTitleKey ¶
func (*Key) GetTypedKey ¶
func (x *Key) GetTypedKey() isKey_TypedKey
func (*Key) ProtoMessage ¶
func (*Key) ProtoMessage()
func (*Key) ProtoReflect ¶
func (x *Key) ProtoReflect() protoreflect.Message
type Key_PlayerKey ¶
type Key_PlayerKey struct {
PlayerKey *PlayerKey `protobuf:"bytes,1,opt,name=player_key,json=playerKey,proto3,oneof"`
}
type Key_TitleKey ¶
type Key_TitleKey struct {
TitleKey *TitleKey `protobuf:"bytes,2,opt,name=title_key,json=titleKey,proto3,oneof"` //TODO any other category of value to be stored
}
type PlayerKey ¶
type PlayerKey struct {
TitleId string `protobuf:"bytes,1,opt,name=title_id,json=titleId,proto3" json:"title_id,omitempty"`
PlayerId string `protobuf:"bytes,2,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
Datatype string `protobuf:"bytes,3,opt,name=datatype,proto3" json:"datatype,omitempty"`
// contains filtered or unexported fields
}
func (*PlayerKey) Descriptor
deprecated
func (*PlayerKey) GetDatatype ¶
func (*PlayerKey) GetPlayerId ¶
func (*PlayerKey) GetTitleId ¶
func (*PlayerKey) ProtoMessage ¶
func (*PlayerKey) ProtoMessage()
func (*PlayerKey) ProtoReflect ¶
func (x *PlayerKey) ProtoReflect() protoreflect.Message
type SetRequest ¶
type SetRequest struct {
Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value *structpb.Struct `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*SetRequest) Descriptor
deprecated
func (*SetRequest) Descriptor() ([]byte, []int)
Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.
func (*SetRequest) GetKey ¶
func (x *SetRequest) GetKey() *Key
func (*SetRequest) GetValue ¶
func (x *SetRequest) GetValue() *structpb.Struct
func (*SetRequest) ProtoMessage ¶
func (*SetRequest) ProtoMessage()
func (*SetRequest) ProtoReflect ¶
func (x *SetRequest) ProtoReflect() protoreflect.Message
func (*SetRequest) Reset ¶
func (x *SetRequest) Reset()
func (*SetRequest) String ¶
func (x *SetRequest) String() string
type SetResponse ¶
type SetResponse struct {
// contains filtered or unexported fields
}
func (*SetResponse) Descriptor
deprecated
func (*SetResponse) Descriptor() ([]byte, []int)
Deprecated: Use SetResponse.ProtoReflect.Descriptor instead.
func (*SetResponse) ProtoMessage ¶
func (*SetResponse) ProtoMessage()
func (*SetResponse) ProtoReflect ¶
func (x *SetResponse) ProtoReflect() protoreflect.Message
func (*SetResponse) Reset ¶
func (x *SetResponse) Reset()
func (*SetResponse) String ¶
func (x *SetResponse) String() string
type StorageServiceClient ¶
type StorageServiceClient interface {
// Get obtains the currently stored value for a given key
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
// Set writes the provided value for the given key - if used concurrently, the last write wins.
Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error)
// Watch streams updates to a given key as they are made
Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchResponse], error)
// Update establishes a two-way connection with the server to:
// - obtain the current value for a key, holding a lock on it and blocking any other "update" or "set" requests for the same key
// - set a new value for the key, releasing the lock on that key and closing the connection
Update(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[UpdateRequest, UpdateResponse], error)
}
StorageServiceClient is the client API for StorageService 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 NewStorageServiceClient ¶
func NewStorageServiceClient(cc grpc.ClientConnInterface) StorageServiceClient
type StorageServiceServer ¶
type StorageServiceServer interface {
// Get obtains the currently stored value for a given key
Get(context.Context, *GetRequest) (*GetResponse, error)
// Set writes the provided value for the given key - if used concurrently, the last write wins.
Set(context.Context, *SetRequest) (*SetResponse, error)
// Watch streams updates to a given key as they are made
Watch(*WatchRequest, grpc.ServerStreamingServer[WatchResponse]) error
// Update establishes a two-way connection with the server to:
// - obtain the current value for a key, holding a lock on it and blocking any other "update" or "set" requests for the same key
// - set a new value for the key, releasing the lock on that key and closing the connection
Update(grpc.BidiStreamingServer[UpdateRequest, UpdateResponse]) error
// contains filtered or unexported methods
}
StorageServiceServer is the server API for StorageService service. All implementations must embed UnimplementedStorageServiceServer for forward compatibility.
type StorageService_UpdateClient ¶
type StorageService_UpdateClient = grpc.BidiStreamingClient[UpdateRequest, UpdateResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type StorageService_UpdateServer ¶
type StorageService_UpdateServer = grpc.BidiStreamingServer[UpdateRequest, UpdateResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type StorageService_WatchClient ¶
type StorageService_WatchClient = grpc.ServerStreamingClient[WatchResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type StorageService_WatchServer ¶
type StorageService_WatchServer = grpc.ServerStreamingServer[WatchResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TitleKey ¶
type TitleKey struct {
TitleId string `protobuf:"bytes,1,opt,name=title_id,json=titleId,proto3" json:"title_id,omitempty"`
Datatype string `protobuf:"bytes,2,opt,name=datatype,proto3" json:"datatype,omitempty"`
// contains filtered or unexported fields
}
func (*TitleKey) Descriptor
deprecated
func (*TitleKey) GetDatatype ¶
func (*TitleKey) GetTitleId ¶
func (*TitleKey) ProtoMessage ¶
func (*TitleKey) ProtoMessage()
func (*TitleKey) ProtoReflect ¶
func (x *TitleKey) ProtoReflect() protoreflect.Message
type UnimplementedStorageServiceServer ¶
type UnimplementedStorageServiceServer struct{}
UnimplementedStorageServiceServer 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 (UnimplementedStorageServiceServer) Get ¶
func (UnimplementedStorageServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error)
func (UnimplementedStorageServiceServer) Set ¶
func (UnimplementedStorageServiceServer) Set(context.Context, *SetRequest) (*SetResponse, error)
func (UnimplementedStorageServiceServer) Update ¶
func (UnimplementedStorageServiceServer) Update(grpc.BidiStreamingServer[UpdateRequest, UpdateResponse]) error
func (UnimplementedStorageServiceServer) Watch ¶
func (UnimplementedStorageServiceServer) Watch(*WatchRequest, grpc.ServerStreamingServer[WatchResponse]) error
type UnsafeStorageServiceServer ¶
type UnsafeStorageServiceServer interface {
// contains filtered or unexported methods
}
UnsafeStorageServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to StorageServiceServer will result in compilation errors.
type UpdateRequest ¶
type UpdateRequest struct {
// Types that are valid to be assigned to RequestType:
//
// *UpdateRequest_Get
// *UpdateRequest_Set
RequestType isUpdateRequest_RequestType `protobuf_oneof:"request_type"`
// contains filtered or unexported fields
}
func (*UpdateRequest) Descriptor
deprecated
func (*UpdateRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.
func (*UpdateRequest) GetGet ¶
func (x *UpdateRequest) GetGet() *GetRequest
func (*UpdateRequest) GetRequestType ¶
func (x *UpdateRequest) GetRequestType() isUpdateRequest_RequestType
func (*UpdateRequest) GetSet ¶
func (x *UpdateRequest) GetSet() *SetRequest
func (*UpdateRequest) ProtoMessage ¶
func (*UpdateRequest) ProtoMessage()
func (*UpdateRequest) ProtoReflect ¶
func (x *UpdateRequest) ProtoReflect() protoreflect.Message
func (*UpdateRequest) Reset ¶
func (x *UpdateRequest) Reset()
func (*UpdateRequest) String ¶
func (x *UpdateRequest) String() string
type UpdateRequest_Get ¶
type UpdateRequest_Get struct {
Get *GetRequest `protobuf:"bytes,1,opt,name=get,proto3,oneof"`
}
type UpdateRequest_Set ¶
type UpdateRequest_Set struct {
Set *SetRequest `protobuf:"bytes,2,opt,name=set,proto3,oneof"`
}
type UpdateResponse ¶
type UpdateResponse struct {
// Types that are valid to be assigned to ResponseType:
//
// *UpdateResponse_Get
// *UpdateResponse_Set
ResponseType isUpdateResponse_ResponseType `protobuf_oneof:"response_type"`
// contains filtered or unexported fields
}
func (*UpdateResponse) Descriptor
deprecated
func (*UpdateResponse) Descriptor() ([]byte, []int)
Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.
func (*UpdateResponse) GetGet ¶
func (x *UpdateResponse) GetGet() *GetResponse
func (*UpdateResponse) GetResponseType ¶
func (x *UpdateResponse) GetResponseType() isUpdateResponse_ResponseType
func (*UpdateResponse) GetSet ¶
func (x *UpdateResponse) GetSet() *SetResponse
func (*UpdateResponse) ProtoMessage ¶
func (*UpdateResponse) ProtoMessage()
func (*UpdateResponse) ProtoReflect ¶
func (x *UpdateResponse) ProtoReflect() protoreflect.Message
func (*UpdateResponse) Reset ¶
func (x *UpdateResponse) Reset()
func (*UpdateResponse) String ¶
func (x *UpdateResponse) String() string
type UpdateResponse_Get ¶
type UpdateResponse_Get struct {
Get *GetResponse `protobuf:"bytes,1,opt,name=get,proto3,oneof"`
}
type UpdateResponse_Set ¶
type UpdateResponse_Set struct {
Set *SetResponse `protobuf:"bytes,2,opt,name=set,proto3,oneof"`
}
type WatchRequest ¶
type WatchRequest struct {
Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
// contains filtered or unexported fields
}
func (*WatchRequest) Descriptor
deprecated
func (*WatchRequest) Descriptor() ([]byte, []int)
Deprecated: Use WatchRequest.ProtoReflect.Descriptor instead.
func (*WatchRequest) GetKey ¶
func (x *WatchRequest) GetKey() *Key
func (*WatchRequest) ProtoMessage ¶
func (*WatchRequest) ProtoMessage()
func (*WatchRequest) ProtoReflect ¶
func (x *WatchRequest) ProtoReflect() protoreflect.Message
func (*WatchRequest) Reset ¶
func (x *WatchRequest) Reset()
func (*WatchRequest) String ¶
func (x *WatchRequest) String() string
type WatchResponse ¶
type WatchResponse struct {
Value *structpb.Struct `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*WatchResponse) Descriptor
deprecated
func (*WatchResponse) Descriptor() ([]byte, []int)
Deprecated: Use WatchResponse.ProtoReflect.Descriptor instead.
func (*WatchResponse) GetValue ¶
func (x *WatchResponse) GetValue() *structpb.Struct
func (*WatchResponse) ProtoMessage ¶
func (*WatchResponse) ProtoMessage()
func (*WatchResponse) ProtoReflect ¶
func (x *WatchResponse) ProtoReflect() protoreflect.Message
func (*WatchResponse) Reset ¶
func (x *WatchResponse) Reset()
func (*WatchResponse) String ¶
func (x *WatchResponse) String() string