Documentation ¶
Index ¶
- Constants
- func NewDatabaseServiceHandler(svc DatabaseServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)
- type DatabaseServiceClient
- type DatabaseServiceHandler
- type UnimplementedDatabaseServiceHandler
- func (UnimplementedDatabaseServiceHandler) BeginList(context.Context, *connect.Request[db.BeginListRequest], ...) error
- func (UnimplementedDatabaseServiceHandler) ContinueList(context.Context, *connect.Request[db.ContinueListRequest], ...) error
- func (UnimplementedDatabaseServiceHandler) Delete(context.Context, *connect.Request[db.DeleteRequest]) (*connect.Response[db.DeleteResponse], error)
- func (UnimplementedDatabaseServiceHandler) Get(context.Context, *connect.Request[db.GetRequest]) (*connect.Response[db.GetResponse], error)
- func (UnimplementedDatabaseServiceHandler) Put(context.Context, *connect.Request[db.PutRequest]) (*connect.Response[db.PutResponse], error)
- func (UnimplementedDatabaseServiceHandler) ScanRootPaths(context.Context, *connect.Request[db.ScanRootPathsRequest]) (*connect.Response[db.ScanRootPathsResponse], error)
- func (UnimplementedDatabaseServiceHandler) SyncList(context.Context, *connect.Request[db.SyncListRequest], ...) error
- func (UnimplementedDatabaseServiceHandler) Transaction(context.Context, ...) error
Constants ¶
const ( // DatabaseServicePutProcedure is the fully-qualified name of the DatabaseService's Put RPC. DatabaseServicePutProcedure = "/stately.db.DatabaseService/Put" // DatabaseServiceGetProcedure is the fully-qualified name of the DatabaseService's Get RPC. DatabaseServiceGetProcedure = "/stately.db.DatabaseService/Get" // DatabaseServiceDeleteProcedure is the fully-qualified name of the DatabaseService's Delete RPC. DatabaseServiceDeleteProcedure = "/stately.db.DatabaseService/Delete" // DatabaseServiceBeginListProcedure is the fully-qualified name of the DatabaseService's BeginList // RPC. DatabaseServiceBeginListProcedure = "/stately.db.DatabaseService/BeginList" // DatabaseServiceContinueListProcedure is the fully-qualified name of the DatabaseService's // ContinueList RPC. DatabaseServiceContinueListProcedure = "/stately.db.DatabaseService/ContinueList" // DatabaseServiceSyncListProcedure is the fully-qualified name of the DatabaseService's SyncList // RPC. DatabaseServiceSyncListProcedure = "/stately.db.DatabaseService/SyncList" // DatabaseServiceTransactionProcedure is the fully-qualified name of the DatabaseService's // Transaction RPC. DatabaseServiceTransactionProcedure = "/stately.db.DatabaseService/Transaction" // DatabaseServiceScanRootPathsProcedure is the fully-qualified name of the DatabaseService's // ScanRootPaths RPC. DatabaseServiceScanRootPathsProcedure = "/stately.db.DatabaseService/ScanRootPaths" )
These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.
const (
// DatabaseServiceName is the fully-qualified name of the DatabaseService service.
DatabaseServiceName = "stately.db.DatabaseService"
)
Variables ¶
This section is empty.
Functions ¶
func NewDatabaseServiceHandler ¶
func NewDatabaseServiceHandler(svc DatabaseServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)
NewDatabaseServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.
By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.
Types ¶
type DatabaseServiceClient ¶
type DatabaseServiceClient interface { // Put adds one or more Items to the Store, or replaces the Items if they // already exist. This will fail if the caller does not have permission to // create or update Items, if there is no schema registered for the provided // item type, or if an item is invalid. All puts are applied atomically; // either all will fail or all will succeed. If an item's schema specifies an // `initialValue` for one or more properties used in its key paths, and the // item is new, you should not provide those values - the database will choose // them for you, and Data must be provided as either serialized binary // protobuf or JSON. Put(context.Context, *connect.Request[db.PutRequest]) (*connect.Response[db.PutResponse], error) // Get retrieves one or more Items by their key paths. This will return any of // the Items that exist. It will fail if the caller does not have permission // to read Items. Use the List APIs if you want to retrieve multiple items but // don't already know the full key paths of the items you want to get. Get(context.Context, *connect.Request[db.GetRequest]) (*connect.Response[db.GetResponse], error) // Delete removes one or more Items from the Store by their key paths. This // will fail if the caller does not have permission to delete Items. // Tombstones will be saved for deleted items for some time, so // that SyncList can return information about deleted items. Deletes are // always applied atomically; all will fail or all will succeed. Delete(context.Context, *connect.Request[db.DeleteRequest]) (*connect.Response[db.DeleteResponse], error) // BeginList retrieves Items that start with a specified key path prefix. The // key path prefix must minimally contain a Group Key (a single key segment // with a namespace and an ID). BeginList will return an empty result set if // there are no items matching that key prefix. This API returns a token that // you can pass to ContinueList to expand the result set, or to SyncList to // get updates within the result set. This can fail if the caller does not // have permission to read Items. // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME BeginList(context.Context, *connect.Request[db.BeginListRequest]) (*connect.ServerStreamForClient[db.ListResponse], error) // ContinueList takes the token from a BeginList call and returns more results // based on the original query parameters and pagination options. It has very // few options of its own because it is a continuation of a previous list // operation. It will return a new token which can be used for another // ContinueList call, and so on. The token is the same one used by SyncList - // each time you call either ContinueList or SyncList, you should pass the // latest version of the token, and then use the new token from the result in // subsequent calls. You may interleave ContinueList and SyncList calls // however you like, but it does not make sense to make both calls in // parallel. Calls to ContinueList are tied to the authorization of the // original BeginList call, so if the original BeginList call was allowed, // ContinueList with its token should also be allowed. // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME ContinueList(context.Context, *connect.Request[db.ContinueListRequest]) (*connect.ServerStreamForClient[db.ListResponse], error) // SyncList returns all changes to Items within the result set of a previous // List operation. For all Items within the result set that were modified, it // returns the full Item at in its current state. It also returns a list of // Item key paths that were deleted since the last SyncList, which you should // reconcile with your view of items returned from previous // BeginList/ContinueList calls. Using this API, you can start with an initial // set of items from BeginList, and then stay up to date on any changes via // repeated SyncList requests over time. The token is the same one used by // ContinueList - each time you call either ContinueList or SyncList, you // should pass the latest version of the token, and then use the new token // from the result in subsequent calls. Note that if the result set has // already been expanded to the end (in the direction of the original // BeginList request), SyncList will return newly created Items. You may // interleave ContinueList and SyncList calls however you like, but it does // not make sense to make both calls in parallel. Calls to SyncList are tied // to the authorization of the original BeginList call, so if the original // BeginList call was allowed, SyncList with its token should also be allowed. SyncList(context.Context, *connect.Request[db.SyncListRequest]) (*connect.ServerStreamForClient[db.SyncListResponse], error) // Transaction performs a transaction, within which you can issue writes // (Put/Delete) and reads (Get/List) in any order, followed by a commit // message. Reads are guaranteed to reflect the state as of when the // transaction started, and writes are committed atomically. This method may // fail if another transaction commits before this one finishes - in that // case, you should retry your transaction. Transaction(context.Context) *connect.BidiStreamForClient[db.TransactionRequest, db.TransactionResponse] // ScanRootPaths lists root paths (Groups) in the Store. This is a very // expensive operation, as it must consult multiple partitions and it reads // and ignores a lot of data. It is provided for use in the web console's data // browser and is not exposed to customers. This operation will fail if the // caller does not have permission to read Items. ScanRootPaths(context.Context, *connect.Request[db.ScanRootPathsRequest]) (*connect.Response[db.ScanRootPathsResponse], error) }
DatabaseServiceClient is a client for the stately.db.DatabaseService service.
func NewDatabaseServiceClient ¶
func NewDatabaseServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) DatabaseServiceClient
NewDatabaseServiceClient constructs a client for the stately.db.DatabaseService service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.
The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).
type DatabaseServiceHandler ¶
type DatabaseServiceHandler interface { // Put adds one or more Items to the Store, or replaces the Items if they // already exist. This will fail if the caller does not have permission to // create or update Items, if there is no schema registered for the provided // item type, or if an item is invalid. All puts are applied atomically; // either all will fail or all will succeed. If an item's schema specifies an // `initialValue` for one or more properties used in its key paths, and the // item is new, you should not provide those values - the database will choose // them for you, and Data must be provided as either serialized binary // protobuf or JSON. Put(context.Context, *connect.Request[db.PutRequest]) (*connect.Response[db.PutResponse], error) // Get retrieves one or more Items by their key paths. This will return any of // the Items that exist. It will fail if the caller does not have permission // to read Items. Use the List APIs if you want to retrieve multiple items but // don't already know the full key paths of the items you want to get. Get(context.Context, *connect.Request[db.GetRequest]) (*connect.Response[db.GetResponse], error) // Delete removes one or more Items from the Store by their key paths. This // will fail if the caller does not have permission to delete Items. // Tombstones will be saved for deleted items for some time, so // that SyncList can return information about deleted items. Deletes are // always applied atomically; all will fail or all will succeed. Delete(context.Context, *connect.Request[db.DeleteRequest]) (*connect.Response[db.DeleteResponse], error) // BeginList retrieves Items that start with a specified key path prefix. The // key path prefix must minimally contain a Group Key (a single key segment // with a namespace and an ID). BeginList will return an empty result set if // there are no items matching that key prefix. This API returns a token that // you can pass to ContinueList to expand the result set, or to SyncList to // get updates within the result set. This can fail if the caller does not // have permission to read Items. // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME BeginList(context.Context, *connect.Request[db.BeginListRequest], *connect.ServerStream[db.ListResponse]) error // ContinueList takes the token from a BeginList call and returns more results // based on the original query parameters and pagination options. It has very // few options of its own because it is a continuation of a previous list // operation. It will return a new token which can be used for another // ContinueList call, and so on. The token is the same one used by SyncList - // each time you call either ContinueList or SyncList, you should pass the // latest version of the token, and then use the new token from the result in // subsequent calls. You may interleave ContinueList and SyncList calls // however you like, but it does not make sense to make both calls in // parallel. Calls to ContinueList are tied to the authorization of the // original BeginList call, so if the original BeginList call was allowed, // ContinueList with its token should also be allowed. // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME ContinueList(context.Context, *connect.Request[db.ContinueListRequest], *connect.ServerStream[db.ListResponse]) error // SyncList returns all changes to Items within the result set of a previous // List operation. For all Items within the result set that were modified, it // returns the full Item at in its current state. It also returns a list of // Item key paths that were deleted since the last SyncList, which you should // reconcile with your view of items returned from previous // BeginList/ContinueList calls. Using this API, you can start with an initial // set of items from BeginList, and then stay up to date on any changes via // repeated SyncList requests over time. The token is the same one used by // ContinueList - each time you call either ContinueList or SyncList, you // should pass the latest version of the token, and then use the new token // from the result in subsequent calls. Note that if the result set has // already been expanded to the end (in the direction of the original // BeginList request), SyncList will return newly created Items. You may // interleave ContinueList and SyncList calls however you like, but it does // not make sense to make both calls in parallel. Calls to SyncList are tied // to the authorization of the original BeginList call, so if the original // BeginList call was allowed, SyncList with its token should also be allowed. SyncList(context.Context, *connect.Request[db.SyncListRequest], *connect.ServerStream[db.SyncListResponse]) error // Transaction performs a transaction, within which you can issue writes // (Put/Delete) and reads (Get/List) in any order, followed by a commit // message. Reads are guaranteed to reflect the state as of when the // transaction started, and writes are committed atomically. This method may // fail if another transaction commits before this one finishes - in that // case, you should retry your transaction. Transaction(context.Context, *connect.BidiStream[db.TransactionRequest, db.TransactionResponse]) error // ScanRootPaths lists root paths (Groups) in the Store. This is a very // expensive operation, as it must consult multiple partitions and it reads // and ignores a lot of data. It is provided for use in the web console's data // browser and is not exposed to customers. This operation will fail if the // caller does not have permission to read Items. ScanRootPaths(context.Context, *connect.Request[db.ScanRootPathsRequest]) (*connect.Response[db.ScanRootPathsResponse], error) }
DatabaseServiceHandler is an implementation of the stately.db.DatabaseService service.
type UnimplementedDatabaseServiceHandler ¶
type UnimplementedDatabaseServiceHandler struct{}
UnimplementedDatabaseServiceHandler returns CodeUnimplemented from all methods.
func (UnimplementedDatabaseServiceHandler) BeginList ¶
func (UnimplementedDatabaseServiceHandler) BeginList(context.Context, *connect.Request[db.BeginListRequest], *connect.ServerStream[db.ListResponse]) error
func (UnimplementedDatabaseServiceHandler) ContinueList ¶
func (UnimplementedDatabaseServiceHandler) ContinueList(context.Context, *connect.Request[db.ContinueListRequest], *connect.ServerStream[db.ListResponse]) error
func (UnimplementedDatabaseServiceHandler) Delete ¶
func (UnimplementedDatabaseServiceHandler) Delete(context.Context, *connect.Request[db.DeleteRequest]) (*connect.Response[db.DeleteResponse], error)
func (UnimplementedDatabaseServiceHandler) Get ¶
func (UnimplementedDatabaseServiceHandler) Get(context.Context, *connect.Request[db.GetRequest]) (*connect.Response[db.GetResponse], error)
func (UnimplementedDatabaseServiceHandler) Put ¶
func (UnimplementedDatabaseServiceHandler) Put(context.Context, *connect.Request[db.PutRequest]) (*connect.Response[db.PutResponse], error)
func (UnimplementedDatabaseServiceHandler) ScanRootPaths ¶
func (UnimplementedDatabaseServiceHandler) ScanRootPaths(context.Context, *connect.Request[db.ScanRootPathsRequest]) (*connect.Response[db.ScanRootPathsResponse], error)
func (UnimplementedDatabaseServiceHandler) SyncList ¶
func (UnimplementedDatabaseServiceHandler) SyncList(context.Context, *connect.Request[db.SyncListRequest], *connect.ServerStream[db.SyncListResponse]) error
func (UnimplementedDatabaseServiceHandler) Transaction ¶
func (UnimplementedDatabaseServiceHandler) Transaction(context.Context, *connect.BidiStream[db.TransactionRequest, db.TransactionResponse]) error