Documentation
¶
Index ¶
- Constants
- func NewDataHandler(svc DataHandler, opts ...connect.HandlerOption) (string, http.Handler)
- type DataClient
- type DataHandler
- type UnimplementedDataHandler
- func (UnimplementedDataHandler) Append(context.Context, *connect.Request[data.AppendRequest]) (*connect.Response[data.AppendResponse], error)
- func (UnimplementedDataHandler) BeginList(context.Context, *connect.Request[data.BeginListRequest], ...) error
- func (UnimplementedDataHandler) ContinueList(context.Context, *connect.Request[data.ContinueListRequest], ...) error
- func (UnimplementedDataHandler) Delete(context.Context, *connect.Request[data.DeleteRequest]) (*connect.Response[data.DeleteResponse], error)
- func (UnimplementedDataHandler) Get(context.Context, *connect.Request[data.GetRequest]) (*connect.Response[data.GetResponse], error)
- func (UnimplementedDataHandler) Put(context.Context, *connect.Request[data.PutRequest]) (*connect.Response[data.PutResponse], error)
- func (UnimplementedDataHandler) ScanRootPaths(context.Context, *connect.Request[data.ScanRootPathsRequest]) (*connect.Response[data.ScanRootPathsResponse], error)
- func (UnimplementedDataHandler) SyncList(context.Context, *connect.Request[data.SyncListRequest], ...) error
- func (UnimplementedDataHandler) Transaction(context.Context, ...) error
Constants ¶
const ( // DataPutProcedure is the fully-qualified name of the Data's Put RPC. DataPutProcedure = "/stately.Data/Put" // DataGetProcedure is the fully-qualified name of the Data's Get RPC. DataGetProcedure = "/stately.Data/Get" // DataDeleteProcedure is the fully-qualified name of the Data's Delete RPC. DataDeleteProcedure = "/stately.Data/Delete" // DataAppendProcedure is the fully-qualified name of the Data's Append RPC. DataAppendProcedure = "/stately.Data/Append" // DataBeginListProcedure is the fully-qualified name of the Data's BeginList RPC. DataBeginListProcedure = "/stately.Data/BeginList" // DataContinueListProcedure is the fully-qualified name of the Data's ContinueList RPC. DataContinueListProcedure = "/stately.Data/ContinueList" // DataSyncListProcedure is the fully-qualified name of the Data's SyncList RPC. DataSyncListProcedure = "/stately.Data/SyncList" // DataTransactionProcedure is the fully-qualified name of the Data's Transaction RPC. DataTransactionProcedure = "/stately.Data/Transaction" // DataScanRootPathsProcedure is the fully-qualified name of the Data's ScanRootPaths RPC. DataScanRootPathsProcedure = "/stately.Data/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 (
// DataName is the fully-qualified name of the Data service.
DataName = "stately.Data"
)
Variables ¶
This section is empty.
Functions ¶
func NewDataHandler ¶
func NewDataHandler(svc DataHandler, opts ...connect.HandlerOption) (string, http.Handler)
NewDataHandler 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 DataClient ¶
type DataClient interface {
// Put adds one or more Items to the Store, or replaces the Items if they
// already exist at that path. This will fail if any of the PutItem requests'
// write conditions fails, or if the caller does not have permission to create
// Items. You may choose whether all puts in the request are applied
// atomically (in a transaction) or not, though some store configurations may
// always apply the whole batch in a transaction (such as in version-tracking
// stores). The status of each Put operation is returned in the response. Data
// can be provided as either JSON, or as a proto encoded by a previously
// agreed upon schema, or by some combination of the two.
Put(context.Context, *connect.Request[data.PutRequest]) (*connect.Response[data.PutResponse], error)
// Get retrieves one or more Items by their full 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 Query 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[data.GetRequest]) (*connect.Response[data.GetResponse], error)
// Delete removes one or more Items from the Store by their full key paths.
// This will fail if the caller does not have permission to delete Items. In
// version-tracking stores, tombstones will be left for deleted items for some
// predetermined time. You may choose whether all deletes in the request are
// applied atomically (in a transaction) or not, though some store types may
// always apply the whole batch in a transaction (such as in version-tracking
// stores). The status of each Delete operation is returned in the response.
Delete(context.Context, *connect.Request[data.DeleteRequest]) (*connect.Response[data.DeleteResponse], error)
// Append adds one or more new Items to a parent path, automatically assigning
// IDs via one of several selectable ID generation strategies (not all
// strategies may be available to all store configurations or path types).
// Because the ID is generated by the server, the new item is guaranteed not
// to overwrite an existing Item. This differs from Put specifically because
// of this ID assignment behavior, and it is recommended over Put for new
// items where you do not want to assign IDs yourself. The assigned IDs will
// be returned in the response. This operation will fail if the caller does
// not have permission to create Items.
Append(context.Context, *connect.Request[data.AppendRequest]) (*connect.Response[data.AppendResponse], error)
// BeginList loads Items that start with a specified key path, subject to
// additional filtering. The prefix must minimally contain a Group Key (an
// item type and an item ID). BeginList will return an empty result set if
// there are no items matching that key prefix. A token is returned from this
// API that you can then 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.
BeginList(context.Context, *connect.Request[data.BeginListRequest]) (*connect.ServerStreamForClient[data.ListResponse], error)
// ContinueList takes the token from a BeginList call and returns the next
// "page" of results based on the original query parameters and pagination
// options. It has few options 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.
ContinueList(context.Context, *connect.Request[data.ContinueListRequest]) (*connect.ServerStreamForClient[data.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[data.SyncListRequest]) (*connect.ServerStreamForClient[data.SyncListResponse], error)
// Transaction performs a transaction, within which you can issue writes and
// reads 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[data.TransactionRequest, data.TransactionResponse]
// ScanRootPaths lists root paths (Groups) in the Store, subject to optional
// filters. This may be a very expensive operation, as it must consult
// multiple partitions that may be distributed around the world. It is
// provided mostly for use in the web console's data browser and may not be
// exposed to customers. This operation will fail if the caller does not have
// permission to read Items.
ScanRootPaths(context.Context, *connect.Request[data.ScanRootPathsRequest]) (*connect.Response[data.ScanRootPathsResponse], error)
}
DataClient is a client for the stately.Data service.
func NewDataClient ¶
func NewDataClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) DataClient
NewDataClient constructs a client for the stately.Data 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 DataHandler ¶
type DataHandler interface {
// Put adds one or more Items to the Store, or replaces the Items if they
// already exist at that path. This will fail if any of the PutItem requests'
// write conditions fails, or if the caller does not have permission to create
// Items. You may choose whether all puts in the request are applied
// atomically (in a transaction) or not, though some store configurations may
// always apply the whole batch in a transaction (such as in version-tracking
// stores). The status of each Put operation is returned in the response. Data
// can be provided as either JSON, or as a proto encoded by a previously
// agreed upon schema, or by some combination of the two.
Put(context.Context, *connect.Request[data.PutRequest]) (*connect.Response[data.PutResponse], error)
// Get retrieves one or more Items by their full 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 Query 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[data.GetRequest]) (*connect.Response[data.GetResponse], error)
// Delete removes one or more Items from the Store by their full key paths.
// This will fail if the caller does not have permission to delete Items. In
// version-tracking stores, tombstones will be left for deleted items for some
// predetermined time. You may choose whether all deletes in the request are
// applied atomically (in a transaction) or not, though some store types may
// always apply the whole batch in a transaction (such as in version-tracking
// stores). The status of each Delete operation is returned in the response.
Delete(context.Context, *connect.Request[data.DeleteRequest]) (*connect.Response[data.DeleteResponse], error)
// Append adds one or more new Items to a parent path, automatically assigning
// IDs via one of several selectable ID generation strategies (not all
// strategies may be available to all store configurations or path types).
// Because the ID is generated by the server, the new item is guaranteed not
// to overwrite an existing Item. This differs from Put specifically because
// of this ID assignment behavior, and it is recommended over Put for new
// items where you do not want to assign IDs yourself. The assigned IDs will
// be returned in the response. This operation will fail if the caller does
// not have permission to create Items.
Append(context.Context, *connect.Request[data.AppendRequest]) (*connect.Response[data.AppendResponse], error)
// BeginList loads Items that start with a specified key path, subject to
// additional filtering. The prefix must minimally contain a Group Key (an
// item type and an item ID). BeginList will return an empty result set if
// there are no items matching that key prefix. A token is returned from this
// API that you can then 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.
BeginList(context.Context, *connect.Request[data.BeginListRequest], *connect.ServerStream[data.ListResponse]) error
// ContinueList takes the token from a BeginList call and returns the next
// "page" of results based on the original query parameters and pagination
// options. It has few options 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.
ContinueList(context.Context, *connect.Request[data.ContinueListRequest], *connect.ServerStream[data.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[data.SyncListRequest], *connect.ServerStream[data.SyncListResponse]) error
// Transaction performs a transaction, within which you can issue writes and
// reads 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[data.TransactionRequest, data.TransactionResponse]) error
// ScanRootPaths lists root paths (Groups) in the Store, subject to optional
// filters. This may be a very expensive operation, as it must consult
// multiple partitions that may be distributed around the world. It is
// provided mostly for use in the web console's data browser and may not be
// exposed to customers. This operation will fail if the caller does not have
// permission to read Items.
ScanRootPaths(context.Context, *connect.Request[data.ScanRootPathsRequest]) (*connect.Response[data.ScanRootPathsResponse], error)
}
DataHandler is an implementation of the stately.Data service.
type UnimplementedDataHandler ¶
type UnimplementedDataHandler struct{}
UnimplementedDataHandler returns CodeUnimplemented from all methods.
func (UnimplementedDataHandler) Append ¶
func (UnimplementedDataHandler) Append(context.Context, *connect.Request[data.AppendRequest]) (*connect.Response[data.AppendResponse], error)
func (UnimplementedDataHandler) BeginList ¶
func (UnimplementedDataHandler) BeginList(context.Context, *connect.Request[data.BeginListRequest], *connect.ServerStream[data.ListResponse]) error
func (UnimplementedDataHandler) ContinueList ¶
func (UnimplementedDataHandler) ContinueList(context.Context, *connect.Request[data.ContinueListRequest], *connect.ServerStream[data.ListResponse]) error
func (UnimplementedDataHandler) Delete ¶
func (UnimplementedDataHandler) Delete(context.Context, *connect.Request[data.DeleteRequest]) (*connect.Response[data.DeleteResponse], error)
func (UnimplementedDataHandler) Get ¶
func (UnimplementedDataHandler) Get(context.Context, *connect.Request[data.GetRequest]) (*connect.Response[data.GetResponse], error)
func (UnimplementedDataHandler) Put ¶
func (UnimplementedDataHandler) Put(context.Context, *connect.Request[data.PutRequest]) (*connect.Response[data.PutResponse], error)
func (UnimplementedDataHandler) ScanRootPaths ¶
func (UnimplementedDataHandler) ScanRootPaths(context.Context, *connect.Request[data.ScanRootPathsRequest]) (*connect.Response[data.ScanRootPathsResponse], error)
func (UnimplementedDataHandler) SyncList ¶
func (UnimplementedDataHandler) SyncList(context.Context, *connect.Request[data.SyncListRequest], *connect.ServerStream[data.SyncListResponse]) error
func (UnimplementedDataHandler) Transaction ¶
func (UnimplementedDataHandler) Transaction(context.Context, *connect.BidiStream[data.TransactionRequest, data.TransactionResponse]) error