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 ErrCouldNotTransactionallyDelete
- type ErrDuplicateRelationshipError
- type ErrEmptyPrecondition
- type ErrExceedsMaximumChecks
- type ErrExceedsMaximumLimit
- type ErrExceedsMaximumPreconditions
- type ErrExceedsMaximumUpdates
- type ErrInvalidCursor
- type ErrInvalidFilter
- type ErrMaxRelationshipContextError
- type ErrNotAPermission
- type ErrPreconditionFailed
- type ErrTransactionMetadataTooLarge
- type PermissionsServerConfig
Constants ¶
const MaximumTransactionMetadataSize = 65000 // bytes. Limited by the BLOB size used in MySQL driver
Variables ¶
This section is empty.
Functions ¶
func BulkExport ¶
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 ¶
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 v0.0.3
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 ¶
func NewExperimentalServer ¶
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 ¶
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 ¶
func NewWatchServer(heartbeatDuration time.Duration) v1.WatchServiceServer
NewWatchServer creates an instance of the watch server.
func TranslateExpansionTree ¶
func TranslateExpansionTree(node *core.RelationTupleTreeNode) *v1.PermissionRelationshipTree
func TranslateRelationshipTree ¶
func TranslateRelationshipTree(tree *v1.PermissionRelationshipTree) *core.RelationTupleTreeNode
TranslateRelationshipTree translates a V1 PermissionRelationshipTree into a RelationTupleTreeNode.
Types ¶
type ErrCouldNotTransactionallyDelete ¶
type ErrCouldNotTransactionallyDelete struct {
// contains filtered or unexported fields
}
ErrCouldNotTransactionallyDelete indicates that a deletion could not occur transactionally.
func NewCouldNotTransactionallyDeleteErr ¶
func NewCouldNotTransactionallyDeleteErr(filter *v1.RelationshipFilter, limit uint32) ErrCouldNotTransactionallyDelete
NewCouldNotTransactionallyDeleteErr constructs a new could not transactionally deleter error.
func (ErrCouldNotTransactionallyDelete) GRPCStatus ¶
func (err ErrCouldNotTransactionallyDelete) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ErrDuplicateRelationshipError ¶
type ErrDuplicateRelationshipError struct {
// contains filtered or unexported fields
}
ErrDuplicateRelationshipError indicates that an update was attempted on the same relationship.
func NewDuplicateRelationshipErr ¶
func NewDuplicateRelationshipErr(update *v1.RelationshipUpdate) ErrDuplicateRelationshipError
NewDuplicateRelationshipErr constructs a new invalid subject error.
func (ErrDuplicateRelationshipError) GRPCStatus ¶
func (err ErrDuplicateRelationshipError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ErrEmptyPrecondition ¶
type ErrEmptyPrecondition struct {
// contains filtered or unexported fields
}
ErrEmptyPrecondition indicates an empty precondition was found.
func NewEmptyPreconditionErr ¶
func NewEmptyPreconditionErr() ErrEmptyPrecondition
NewEmptyPreconditionErr constructs a new empty precondition error.
func (ErrEmptyPrecondition) GRPCStatus ¶
func (err ErrEmptyPrecondition) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ErrExceedsMaximumChecks ¶
type ErrExceedsMaximumChecks struct {
// contains filtered or unexported fields
}
ErrExceedsMaximumChecks occurs when too many checks are given to a call.
func NewExceedsMaximumChecksErr ¶
func NewExceedsMaximumChecksErr(checkCount uint64, maxCountAllowed uint64) ErrExceedsMaximumChecks
NewExceedsMaximumChecksErr creates a new error representing that too many updates were given to a BulkCheckPermissions call.
func (ErrExceedsMaximumChecks) GRPCStatus ¶
func (err ErrExceedsMaximumChecks) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ErrExceedsMaximumChecks) MarshalZerologObject ¶
func (err ErrExceedsMaximumChecks) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ErrExceedsMaximumLimit ¶
type ErrExceedsMaximumLimit struct {
// contains filtered or unexported fields
}
ErrExceedsMaximumLimit occurs when a limit that is too large is given to a call.
func NewExceedsMaximumLimitErr ¶
func NewExceedsMaximumLimitErr(providedLimit uint64, maxLimitAllowed uint64) ErrExceedsMaximumLimit
NewExceedsMaximumLimitErr creates a new error representing that the limit specified was too large.
func (ErrExceedsMaximumLimit) GRPCStatus ¶
func (err ErrExceedsMaximumLimit) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ErrExceedsMaximumLimit) MarshalZerologObject ¶
func (err ErrExceedsMaximumLimit) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ErrExceedsMaximumPreconditions ¶
type ErrExceedsMaximumPreconditions struct {
// contains filtered or unexported fields
}
ErrExceedsMaximumPreconditions occurs when too many preconditions are given to a call.
func NewExceedsMaximumPreconditionsErr ¶
func NewExceedsMaximumPreconditionsErr(preconditionCount uint64, maxCountAllowed uint64) ErrExceedsMaximumPreconditions
NewExceedsMaximumPreconditionsErr creates a new error representing that too many preconditions were given to a call.
func (ErrExceedsMaximumPreconditions) GRPCStatus ¶
func (err ErrExceedsMaximumPreconditions) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ErrExceedsMaximumPreconditions) MarshalZerologObject ¶
func (err ErrExceedsMaximumPreconditions) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ErrExceedsMaximumUpdates ¶
type ErrExceedsMaximumUpdates struct {
// contains filtered or unexported fields
}
ErrExceedsMaximumUpdates occurs when too many updates are given to a call.
func NewExceedsMaximumUpdatesErr ¶
func NewExceedsMaximumUpdatesErr(updateCount uint64, maxCountAllowed uint64) ErrExceedsMaximumUpdates
NewExceedsMaximumUpdatesErr creates a new error representing that too many updates were given to a WriteRelationships call.
func (ErrExceedsMaximumUpdates) GRPCStatus ¶
func (err ErrExceedsMaximumUpdates) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ErrExceedsMaximumUpdates) MarshalZerologObject ¶
func (err ErrExceedsMaximumUpdates) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ErrInvalidCursor ¶
type ErrInvalidCursor struct {
// contains filtered or unexported fields
}
ErrInvalidCursor indicates that an invalid cursor was found.
func NewInvalidCursorErr ¶
func NewInvalidCursorErr(reason string) ErrInvalidCursor
NewInvalidCursorErr constructs a new invalid cursor error.
func (ErrInvalidCursor) GRPCStatus ¶
func (err ErrInvalidCursor) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ErrInvalidFilter ¶
type ErrInvalidFilter struct {
// contains filtered or unexported fields
}
ErrInvalidFilter indicates the specified relationship filter was invalid.
func NewInvalidFilterErr ¶
func NewInvalidFilterErr(reason string, filter string) ErrInvalidFilter
NewInvalidFilterErr constructs a new invalid filter error.
func (ErrInvalidFilter) GRPCStatus ¶
func (err ErrInvalidFilter) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ErrMaxRelationshipContextError ¶
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 ¶
func NewMaxRelationshipContextError(update *v1.RelationshipUpdate, maxAllowedSize int) ErrMaxRelationshipContextError
NewMaxRelationshipContextError constructs a new max relationship context error.
func (ErrMaxRelationshipContextError) GRPCStatus ¶
func (err ErrMaxRelationshipContextError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ErrNotAPermission ¶
type ErrNotAPermission struct {
// contains filtered or unexported fields
}
ErrNotAPermission indicates that the relation is not a permission.
func NewNotAPermissionError ¶
func NewNotAPermissionError(relationName string) ErrNotAPermission
NewNotAPermissionError constructs a new not a permission error.
func (ErrNotAPermission) GRPCStatus ¶
func (err ErrNotAPermission) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type ErrPreconditionFailed ¶
type ErrPreconditionFailed struct {
// contains filtered or unexported fields
}
ErrPreconditionFailed occurs when the precondition to a write tuple call does not match.
func (ErrPreconditionFailed) GRPCStatus ¶
func (err ErrPreconditionFailed) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (ErrPreconditionFailed) MarshalZerologObject ¶
func (err ErrPreconditionFailed) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ErrTransactionMetadataTooLarge ¶ added in v0.0.3
type ErrTransactionMetadataTooLarge struct {
// contains filtered or unexported fields
}
ErrTransactionMetadataTooLarge indicates that the metadata for a transaction is too large.
func NewTransactionMetadataTooLargeErr ¶ added in v0.0.3
func NewTransactionMetadataTooLargeErr(metadataSize int, maxSize int) ErrTransactionMetadataTooLarge
NewTransactionMetadataTooLargeErr constructs a new transaction metadata too large error.
func (ErrTransactionMetadataTooLarge) GRPCStatus ¶ added in v0.0.3
func (err ErrTransactionMetadataTooLarge) GRPCStatus() *status.Status
func (ErrTransactionMetadataTooLarge) MarshalZerologObject ¶ added in v0.0.3
func (err ErrTransactionMetadataTooLarge) MarshalZerologObject(e *zerolog.Event)
type PermissionsServerConfig ¶
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 // UseExperimentalLookupResources2 enables the experimental LookupResources2 API. UseExperimentalLookupResources2 bool }
PermissionsServerConfig is configuration for the permissions server.