Documentation ¶
Index ¶
- Constants
- func BulkExport(ctx context.Context, ds datastore.ReadOnlyDatastore, batchSize uint64, ...) error
- func ConvertCheckDispatchDebugInformation(ctx context.Context, caveatContext map[string]any, ...) (*v1.DebugInformation, error)
- func ExportBulk(ctx context.Context, ds datastore.Datastore, batchSize uint64, ...) error
- func GetCaveatContext(ctx context.Context, caveatCtx *structpb.Struct, maxCaveatContextSize int) (map[string]any, error)
- func NewExperimentalServer(dispatch dispatch.Dispatcher, permServerConfig PermissionsServerConfig, ...) v1.ExperimentalServiceServer
- func NewPermissionsServer(dispatch dispatch.Dispatcher, config PermissionsServerConfig) v1.PermissionsServiceServer
- func NewPreconditionFailedErr(precondition *v1.Precondition) error
- func NewSchemaServer(additiveOnly bool) v1.SchemaServiceServer
- func NewWatchServer(heartbeatDuration time.Duration) v1.WatchServiceServer
- func TranslateExpansionTree(node *core.RelationTupleTreeNode) *v1.PermissionRelationshipTree
- func TranslateRelationshipTree(tree *v1.PermissionRelationshipTree) *core.RelationTupleTreeNode
- type CouldNotTransactionallyDeleteError
- type DuplicateRelationErrorshipError
- type EmptyPreconditionError
- type ErrMaxRelationshipContextError
- type ExceedsMaximumChecksError
- type ExceedsMaximumLimitError
- type ExceedsMaximumPreconditionsError
- type ExceedsMaximumUpdatesError
- type InvalidCursorError
- type InvalidFilterError
- type NotAPermissionError
- type PermissionsServerConfig
- type PreconditionFailedError
- type TransactionMetadataTooLargeError
Constants ¶
const MaximumTransactionMetadataSize = 65000 // bytes. Limited by the BLOB size used in MySQL driver
Variables ¶
This section is empty.
Functions ¶
func BulkExport ¶ added in v1.33.0
func BulkExport(ctx context.Context, ds datastore.ReadOnlyDatastore, batchSize uint64, req *v1.BulkExportRelationshipsRequest, fallbackRevision datastore.Revision, sender func(response *v1.BulkExportRelationshipsResponse) error) error
BulkExport implements the BulkExportRelationships API functionality. Given a datastore.Datastore, it will export stream via the sender all relationships matched by the incoming request. If no cursor is provided, it will fallback to the provided revision.
func ConvertCheckDispatchDebugInformation ¶ added in v1.16.2
func ConvertCheckDispatchDebugInformation( ctx context.Context, caveatContext map[string]any, debugInfo *dispatch.DebugInformation, reader datastore.Reader, ) (*v1.DebugInformation, error)
ConvertCheckDispatchDebugInformation converts dispatch debug information found in the response metadata into DebugInformation returnable to the API.
func ExportBulk ¶ added in v1.37.0
func ExportBulk(ctx context.Context, ds datastore.Datastore, batchSize uint64, req *v1.ExportBulkRelationshipsRequest, fallbackRevision datastore.Revision, sender func(response *v1.ExportBulkRelationshipsResponse) error) error
ExportBulk implements the ExportBulkRelationships API functionality. Given a datastore.Datastore, it will export stream via the sender all relationships matched by the incoming request. If no cursor is provided, it will fallback to the provided revision.
func GetCaveatContext ¶ added in v1.18.0
func NewExperimentalServer ¶ added in v1.22.0
func NewExperimentalServer(dispatch dispatch.Dispatcher, permServerConfig PermissionsServerConfig, opts ...options.ExperimentalServerOptionsOption) v1.ExperimentalServiceServer
NewExperimentalServer creates a ExperimentalServiceServer instance.
func NewPermissionsServer ¶
func NewPermissionsServer( dispatch dispatch.Dispatcher, config PermissionsServerConfig, ) v1.PermissionsServiceServer
NewPermissionsServer creates a PermissionsServiceServer instance.
func NewPreconditionFailedErr ¶ added in v1.14.0
func NewPreconditionFailedErr(precondition *v1.Precondition) error
NewPreconditionFailedErr constructs a new precondition failed error.
func NewSchemaServer ¶
func NewSchemaServer(additiveOnly bool) v1.SchemaServiceServer
NewSchemaServer creates a SchemaServiceServer instance.
func NewWatchServer ¶ added in v1.2.0
func NewWatchServer(heartbeatDuration time.Duration) v1.WatchServiceServer
NewWatchServer creates an instance of the watch server.
func TranslateExpansionTree ¶ added in v1.5.0
func TranslateExpansionTree(node *core.RelationTupleTreeNode) *v1.PermissionRelationshipTree
func TranslateRelationshipTree ¶ added in v1.2.0
func TranslateRelationshipTree(tree *v1.PermissionRelationshipTree) *core.RelationTupleTreeNode
TranslateRelationshipTree translates a V1 PermissionRelationshipTree into a RelationTupleTreeNode.
Types ¶
type CouldNotTransactionallyDeleteError ¶ added in v1.39.0
type CouldNotTransactionallyDeleteError struct {
// contains filtered or unexported fields
}
CouldNotTransactionallyDeleteError indicates that a deletion could not occur transactionally.
func NewCouldNotTransactionallyDeleteErr ¶ added in v1.22.0
func NewCouldNotTransactionallyDeleteErr(filter *v1.RelationshipFilter, limit uint32) CouldNotTransactionallyDeleteError
NewCouldNotTransactionallyDeleteErr constructs a new could not transactionally deleter error.
func (CouldNotTransactionallyDeleteError) GRPCStatus ¶ added in v1.39.0
func (err CouldNotTransactionallyDeleteError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type DuplicateRelationErrorshipError ¶ added in v1.39.0
type DuplicateRelationErrorshipError struct {
// contains filtered or unexported fields
}
DuplicateRelationErrorshipError indicates that an update was attempted on the same relationship.
func NewDuplicateRelationshipErr ¶ added in v1.15.0
func NewDuplicateRelationshipErr(update *v1.RelationshipUpdate) DuplicateRelationErrorshipError
NewDuplicateRelationshipErr constructs a new invalid subject error.
func (DuplicateRelationErrorshipError) GRPCStatus ¶ added in v1.39.0
func (err DuplicateRelationErrorshipError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type EmptyPreconditionError ¶ added in v1.39.0
type EmptyPreconditionError struct {
// contains filtered or unexported fields
}
EmptyPreconditionError indicates an empty precondition was found.
func NewEmptyPreconditionErr ¶ added in v1.30.0
func NewEmptyPreconditionErr() EmptyPreconditionError
NewEmptyPreconditionErr constructs a new empty precondition error.
func (EmptyPreconditionError) GRPCStatus ¶ added in v1.39.0
func (err EmptyPreconditionError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ErrMaxRelationshipContextError ¶ added in v1.22.0
type ErrMaxRelationshipContextError struct {
// contains filtered or unexported fields
}
ErrMaxRelationshipContextError indicates an attempt to write a relationship that exceeded the maximum configured context size.
func NewMaxRelationshipContextError ¶ added in v1.22.0
func NewMaxRelationshipContextError(update *v1.RelationshipUpdate, maxAllowedSize int) ErrMaxRelationshipContextError
NewMaxRelationshipContextError constructs a new max relationship context error.
func (ErrMaxRelationshipContextError) GRPCStatus ¶ added in v1.22.0
func (err ErrMaxRelationshipContextError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ExceedsMaximumChecksError ¶ added in v1.39.0
type ExceedsMaximumChecksError struct {
// contains filtered or unexported fields
}
ExceedsMaximumChecksError occurs when too many checks are given to a call.
func NewExceedsMaximumChecksErr ¶ added in v1.30.0
func NewExceedsMaximumChecksErr(checkCount uint64, maxCountAllowed uint64) ExceedsMaximumChecksError
NewExceedsMaximumChecksErr creates a new error representing that too many updates were given to a BulkCheckPermissions call.
func (ExceedsMaximumChecksError) GRPCStatus ¶ added in v1.39.0
func (err ExceedsMaximumChecksError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ExceedsMaximumChecksError) MarshalZerologObject ¶ added in v1.39.0
func (err ExceedsMaximumChecksError) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ExceedsMaximumLimitError ¶ added in v1.39.0
type ExceedsMaximumLimitError struct {
// contains filtered or unexported fields
}
ExceedsMaximumLimitError occurs when a limit that is too large is given to a call.
func NewExceedsMaximumLimitErr ¶ added in v1.32.0
func NewExceedsMaximumLimitErr(providedLimit uint64, maxLimitAllowed uint64) ExceedsMaximumLimitError
NewExceedsMaximumLimitErr creates a new error representing that the limit specified was too large.
func (ExceedsMaximumLimitError) GRPCStatus ¶ added in v1.39.0
func (err ExceedsMaximumLimitError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ExceedsMaximumLimitError) MarshalZerologObject ¶ added in v1.39.0
func (err ExceedsMaximumLimitError) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ExceedsMaximumPreconditionsError ¶ added in v1.39.0
type ExceedsMaximumPreconditionsError struct {
// contains filtered or unexported fields
}
ExceedsMaximumPreconditionsError occurs when too many preconditions are given to a call.
func NewExceedsMaximumPreconditionsErr ¶ added in v1.14.0
func NewExceedsMaximumPreconditionsErr(preconditionCount uint64, maxCountAllowed uint64) ExceedsMaximumPreconditionsError
NewExceedsMaximumPreconditionsErr creates a new error representing that too many preconditions were given to a call.
func (ExceedsMaximumPreconditionsError) GRPCStatus ¶ added in v1.39.0
func (err ExceedsMaximumPreconditionsError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ExceedsMaximumPreconditionsError) MarshalZerologObject ¶ added in v1.39.0
func (err ExceedsMaximumPreconditionsError) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ExceedsMaximumUpdatesError ¶ added in v1.39.0
type ExceedsMaximumUpdatesError struct {
// contains filtered or unexported fields
}
ExceedsMaximumUpdatesError occurs when too many updates are given to a call.
func NewExceedsMaximumUpdatesErr ¶ added in v1.14.0
func NewExceedsMaximumUpdatesErr(updateCount uint64, maxCountAllowed uint64) ExceedsMaximumUpdatesError
NewExceedsMaximumUpdatesErr creates a new error representing that too many updates were given to a WriteRelationships call.
func (ExceedsMaximumUpdatesError) GRPCStatus ¶ added in v1.39.0
func (err ExceedsMaximumUpdatesError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ExceedsMaximumUpdatesError) MarshalZerologObject ¶ added in v1.39.0
func (err ExceedsMaximumUpdatesError) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type InvalidCursorError ¶ added in v1.39.0
type InvalidCursorError struct {
// contains filtered or unexported fields
}
InvalidCursorError indicates that an invalid cursor was found.
func NewInvalidCursorErr ¶ added in v1.22.0
func NewInvalidCursorErr(reason string) InvalidCursorError
NewInvalidCursorErr constructs a new invalid cursor error.
func (InvalidCursorError) GRPCStatus ¶ added in v1.39.0
func (err InvalidCursorError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type InvalidFilterError ¶ added in v1.39.0
type InvalidFilterError struct {
// contains filtered or unexported fields
}
InvalidFilterError indicates the specified relationship filter was invalid.
func NewInvalidFilterErr ¶ added in v1.30.0
func NewInvalidFilterErr(reason string, filter string) InvalidFilterError
NewInvalidFilterErr constructs a new invalid filter error.
func (InvalidFilterError) GRPCStatus ¶ added in v1.39.0
func (err InvalidFilterError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type NotAPermissionError ¶ added in v1.39.0
type NotAPermissionError struct {
// contains filtered or unexported fields
}
NotAPermissionError indicates that the relation is not a permission.
func NewNotAPermissionError ¶ added in v1.33.0
func NewNotAPermissionError(relationName string) NotAPermissionError
NewNotAPermissionError constructs a new not a permission error.
func (NotAPermissionError) GRPCStatus ¶ added in v1.39.0
func (err NotAPermissionError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type PermissionsServerConfig ¶ added in v1.12.0
type PermissionsServerConfig struct { // MaxUpdatesPerWrite holds the maximum number of updates allowed per // WriteRelationships call. MaxUpdatesPerWrite uint16 // MaxPreconditionsCount holds the maximum number of preconditions allowed // on a WriteRelationships or DeleteRelationships call. MaxPreconditionsCount uint16 // MaximumAPIDepth is the default/starting depth remaining for API calls made // to the permissions server. MaximumAPIDepth uint32 // DispatchChunkSize is the maximum number of elements to dispach in a dispatch call DispatchChunkSize uint16 // StreamingAPITimeout is the timeout for streaming APIs when no response has been // recently received. StreamingAPITimeout time.Duration // MaxCaveatContextSize defines the maximum length of the request caveat context in bytes MaxCaveatContextSize int // MaxRelationshipContextSize defines the maximum length of a relationship's context in bytes MaxRelationshipContextSize int // MaxDatastoreReadPageSize defines the maximum number of relationships loaded from the // datastore in one query. MaxDatastoreReadPageSize uint64 // MaxCheckBulkConcurrency defines the maximum number of concurrent checks that can be // made in a single CheckBulkPermissions call. MaxCheckBulkConcurrency uint16 // MaxReadRelationshipsLimit defines the maximum number of relationships that can be read // in a single ReadRelationships call. MaxReadRelationshipsLimit uint32 // MaxDeleteRelationshipsLimit defines the maximum number of relationships that can be deleted // in a single DeleteRelationships call. MaxDeleteRelationshipsLimit uint32 // MaxLookupResourcesLimit defines the maximum number of resources that can be looked up in a // single LookupResources call. MaxLookupResourcesLimit uint32 // MaxBulkExportRelationshipsLimit defines the maximum number of relationships that can be // exported in a single BulkExportRelationships call. MaxBulkExportRelationshipsLimit uint32 }
PermissionsServerConfig is configuration for the permissions server.
type PreconditionFailedError ¶ added in v1.39.0
type PreconditionFailedError struct {
// contains filtered or unexported fields
}
PreconditionFailedError occurs when the precondition to a write tuple call does not match.
func (PreconditionFailedError) GRPCStatus ¶ added in v1.39.0
func (err PreconditionFailedError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (PreconditionFailedError) MarshalZerologObject ¶ added in v1.39.0
func (err PreconditionFailedError) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type TransactionMetadataTooLargeError ¶ added in v1.39.0
type TransactionMetadataTooLargeError struct {
// contains filtered or unexported fields
}
TransactionMetadataTooLargeError indicates that the metadata for a transaction is too large.
func NewTransactionMetadataTooLargeErr ¶ added in v1.38.0
func NewTransactionMetadataTooLargeErr(metadataSize int, maxSize int) TransactionMetadataTooLargeError
NewTransactionMetadataTooLargeErr constructs a new transaction metadata too large error.
func (TransactionMetadataTooLargeError) GRPCStatus ¶ added in v1.39.0
func (err TransactionMetadataTooLargeError) GRPCStatus() *status.Status
func (TransactionMetadataTooLargeError) MarshalZerologObject ¶ added in v1.39.0
func (err TransactionMetadataTooLargeError) MarshalZerologObject(e *zerolog.Event)