Documentation ¶
Overview ¶
Package commands contains the code that handles each endpoint.
Index ¶
- Variables
- func CheckCommandErrorToServerError(err error) error
- type BatchCheckCommandParams
- type BatchCheckMetadata
- type BatchCheckOutcome
- type BatchCheckQuery
- type BatchCheckQueryOption
- func WithBatchCheckCommandCacheController(cc cachecontroller.CacheController) BatchCheckQueryOption
- func WithBatchCheckCommandLogger(l logger.Logger) BatchCheckQueryOption
- func WithBatchCheckMaxChecksPerBatch(maxChecks uint32) BatchCheckQueryOption
- func WithBatchCheckMaxConcurrentChecks(maxConcurrentChecks uint32) BatchCheckQueryOption
- type BatchCheckValidationError
- type CheckCommandParams
- type CheckQuery
- type CheckQueryOption
- type CorrelationID
- type CreateStoreCmdOption
- type CreateStoreCommand
- type DeleteStoreCmdOption
- type DeleteStoreCommand
- type ExpandQuery
- type ExpandQueryOption
- type GetStoreQuery
- type GetStoreQueryOption
- type InvalidRelationError
- type InvalidTupleError
- type ListObjectsQuery
- type ListObjectsQueryOption
- func WithDispatchThrottlerConfig(config threshold.Config) ListObjectsQueryOption
- func WithListObjectsDeadline(deadline time.Duration) ListObjectsQueryOption
- func WithListObjectsMaxResults(max uint32) ListObjectsQueryOption
- func WithLogger(l logger.Logger) ListObjectsQueryOption
- func WithMaxConcurrentReads(limit uint32) ListObjectsQueryOption
- func WithResolveNodeBreadthLimit(limit uint32) ListObjectsQueryOption
- func WithResolveNodeLimit(limit uint32) ListObjectsQueryOption
- type ListObjectsResolutionMetadata
- type ListObjectsResponse
- type ListObjectsResult
- type ListStoresQuery
- type ListStoresQueryOption
- type ReadAssertionsQuery
- type ReadAssertionsQueryOption
- type ReadAuthModelQueryOption
- type ReadAuthModelsQueryOption
- type ReadAuthorizationModelQuery
- type ReadAuthorizationModelsQuery
- type ReadChangesQuery
- type ReadChangesQueryOption
- func WithContinuationTokenSerializer(tokenSerializer encoder.ContinuationTokenSerializer) ReadChangesQueryOption
- func WithReadChangeQueryHorizonOffset(horizonOffset int) ReadChangesQueryOption
- func WithReadChangesQueryEncoder(e encoder.Encoder) ReadChangesQueryOption
- func WithReadChangesQueryLogger(l logger.Logger) ReadChangesQueryOption
- type ReadQuery
- type ReadQueryOption
- type ThrottledError
- type WriteAssertionsCmdOption
- type WriteAssertionsCommand
- type WriteAuthModelOption
- type WriteAuthorizationModelCommand
- type WriteCommand
- type WriteCommandOption
Constants ¶
This section is empty.
Variables ¶
var DefaultMaxAssertionSizeInBytes = 64000 // 64KB
DefaultMaxAssertionSizeInBytes is 64KB because MySQL supports up to 64 KB in one BLOB. In the future we may want to make it a LONGBLOB (4 GB) and/or make this value configurable based on the datastore.
Functions ¶
func CheckCommandErrorToServerError ¶ added in v1.7.0
CheckCommandErrorToServerError converts internal errors thrown during the check_command into consumer-facing errors to be sent over the wire.
Types ¶
type BatchCheckCommandParams ¶ added in v1.8.0
type BatchCheckCommandParams struct { AuthorizationModelID string Checks []*openfgav1.BatchCheckItem Consistency openfgav1.ConsistencyPreference StoreID string }
type BatchCheckMetadata ¶ added in v1.8.0
type BatchCheckMetadata struct {
DatastoreQueryCount uint32
}
type BatchCheckOutcome ¶ added in v1.8.0
type BatchCheckOutcome struct { CheckResponse *graph.ResolveCheckResponse Err error }
type BatchCheckQuery ¶ added in v1.8.0
type BatchCheckQuery struct {
// contains filtered or unexported fields
}
func NewBatchCheckCommand ¶ added in v1.8.0
func NewBatchCheckCommand(datastore storage.RelationshipTupleReader, checkResolver graph.CheckResolver, typesys *typesystem.TypeSystem, opts ...BatchCheckQueryOption) *BatchCheckQuery
func (*BatchCheckQuery) Execute ¶ added in v1.8.0
func (bq *BatchCheckQuery) Execute(ctx context.Context, params *BatchCheckCommandParams) (map[CorrelationID]*BatchCheckOutcome, *BatchCheckMetadata, error)
type BatchCheckQueryOption ¶ added in v1.8.0
type BatchCheckQueryOption func(*BatchCheckQuery)
func WithBatchCheckCommandCacheController ¶ added in v1.8.0
func WithBatchCheckCommandCacheController(cc cachecontroller.CacheController) BatchCheckQueryOption
func WithBatchCheckCommandLogger ¶ added in v1.8.0
func WithBatchCheckCommandLogger(l logger.Logger) BatchCheckQueryOption
func WithBatchCheckMaxChecksPerBatch ¶ added in v1.8.0
func WithBatchCheckMaxChecksPerBatch(maxChecks uint32) BatchCheckQueryOption
func WithBatchCheckMaxConcurrentChecks ¶ added in v1.8.0
func WithBatchCheckMaxConcurrentChecks(maxConcurrentChecks uint32) BatchCheckQueryOption
type BatchCheckValidationError ¶ added in v1.8.0
type BatchCheckValidationError struct {
Message string
}
func (BatchCheckValidationError) Error ¶ added in v1.8.0
func (e BatchCheckValidationError) Error() string
type CheckCommandParams ¶ added in v1.7.0
type CheckCommandParams struct { StoreID string TupleKey *openfgav1.CheckRequestTupleKey ContextualTuples *openfgav1.ContextualTupleKeys Context *structpb.Struct Consistency openfgav1.ConsistencyPreference }
type CheckQuery ¶
type CheckQuery struct {
// contains filtered or unexported fields
}
func NewCheckCommand ¶ added in v1.6.2
func NewCheckCommand(datastore storage.RelationshipTupleReader, checkResolver graph.CheckResolver, typesys *typesystem.TypeSystem, opts ...CheckQueryOption) *CheckQuery
func (*CheckQuery) Execute ¶
func (c *CheckQuery) Execute(ctx context.Context, params *CheckCommandParams) (*graph.ResolveCheckResponse, *graph.ResolveCheckRequestMetadata, error)
type CheckQueryOption ¶ added in v1.6.2
type CheckQueryOption func(*CheckQuery)
func WithCacheController ¶ added in v1.7.0
func WithCacheController(ctrl cachecontroller.CacheController) CheckQueryOption
func WithCheckCommandLogger ¶ added in v1.6.2
func WithCheckCommandLogger(l logger.Logger) CheckQueryOption
func WithCheckCommandMaxConcurrentReads ¶ added in v1.6.2
func WithCheckCommandMaxConcurrentReads(m uint32) CheckQueryOption
func WithCheckCommandResolveNodeLimit ¶ added in v1.6.2
func WithCheckCommandResolveNodeLimit(nl uint32) CheckQueryOption
type CorrelationID ¶ added in v1.8.0
type CorrelationID string
type CreateStoreCmdOption ¶ added in v1.3.8
type CreateStoreCmdOption func(*CreateStoreCommand)
func WithCreateStoreCmdLogger ¶ added in v1.3.8
func WithCreateStoreCmdLogger(l logger.Logger) CreateStoreCmdOption
type CreateStoreCommand ¶
type CreateStoreCommand struct {
// contains filtered or unexported fields
}
func NewCreateStoreCommand ¶
func NewCreateStoreCommand( storesBackend storage.StoresBackend, opts ...CreateStoreCmdOption, ) *CreateStoreCommand
func (*CreateStoreCommand) Execute ¶
func (s *CreateStoreCommand) Execute(ctx context.Context, req *openfgav1.CreateStoreRequest) (*openfgav1.CreateStoreResponse, error)
type DeleteStoreCmdOption ¶ added in v1.3.8
type DeleteStoreCmdOption func(*DeleteStoreCommand)
func WithDeleteStoreCmdLogger ¶ added in v1.3.8
func WithDeleteStoreCmdLogger(l logger.Logger) DeleteStoreCmdOption
type DeleteStoreCommand ¶
type DeleteStoreCommand struct {
// contains filtered or unexported fields
}
func NewDeleteStoreCommand ¶
func NewDeleteStoreCommand( storesBackend storage.StoresBackend, opts ...DeleteStoreCmdOption, ) *DeleteStoreCommand
func (*DeleteStoreCommand) Execute ¶
func (s *DeleteStoreCommand) Execute(ctx context.Context, req *openfgav1.DeleteStoreRequest) (*openfgav1.DeleteStoreResponse, error)
type ExpandQuery ¶
type ExpandQuery struct {
// contains filtered or unexported fields
}
ExpandQuery resolves a target TupleKey into a UsersetTree by expanding type definitions.
func NewExpandQuery ¶
func NewExpandQuery(datastore storage.OpenFGADatastore, opts ...ExpandQueryOption) *ExpandQuery
NewExpandQuery creates a new ExpandQuery using the supplied backends for retrieving data.
func (*ExpandQuery) Execute ¶
func (q *ExpandQuery) Execute(ctx context.Context, req *openfgav1.ExpandRequest) (*openfgav1.ExpandResponse, error)
type ExpandQueryOption ¶ added in v1.3.8
type ExpandQueryOption func(*ExpandQuery)
func WithExpandQueryLogger ¶ added in v1.3.8
func WithExpandQueryLogger(l logger.Logger) ExpandQueryOption
type GetStoreQuery ¶
type GetStoreQuery struct {
// contains filtered or unexported fields
}
func NewGetStoreQuery ¶
func NewGetStoreQuery(storesBackend storage.StoresBackend, opts ...GetStoreQueryOption) *GetStoreQuery
func (*GetStoreQuery) Execute ¶
func (q *GetStoreQuery) Execute(ctx context.Context, req *openfgav1.GetStoreRequest) (*openfgav1.GetStoreResponse, error)
type GetStoreQueryOption ¶ added in v1.3.8
type GetStoreQueryOption func(*GetStoreQuery)
func WithGetStoreQueryLogger ¶ added in v1.3.8
func WithGetStoreQueryLogger(l logger.Logger) GetStoreQueryOption
type InvalidRelationError ¶ added in v1.7.0
type InvalidRelationError struct {
Cause error
}
func (*InvalidRelationError) Error ¶ added in v1.7.0
func (e *InvalidRelationError) Error() string
func (*InvalidRelationError) Unwrap ¶ added in v1.7.0
func (e *InvalidRelationError) Unwrap() error
type InvalidTupleError ¶ added in v1.7.0
type InvalidTupleError struct {
Cause error
}
func (*InvalidTupleError) Error ¶ added in v1.7.0
func (e *InvalidTupleError) Error() string
func (*InvalidTupleError) Unwrap ¶ added in v1.7.0
func (e *InvalidTupleError) Unwrap() error
type ListObjectsQuery ¶
type ListObjectsQuery struct {
// contains filtered or unexported fields
}
func NewListObjectsQuery ¶ added in v1.3.0
func NewListObjectsQuery( ds storage.RelationshipTupleReader, checkResolver graph.CheckResolver, opts ...ListObjectsQueryOption, ) (*ListObjectsQuery, error)
func (*ListObjectsQuery) Execute ¶
func (q *ListObjectsQuery) Execute( ctx context.Context, req *openfgav1.ListObjectsRequest, ) (*ListObjectsResponse, error)
Execute the ListObjectsQuery, returning a list of object IDs up to a maximum of q.listObjectsMaxResults or until q.listObjectsDeadline is hit, whichever happens first.
func (*ListObjectsQuery) ExecuteStreamed ¶
func (q *ListObjectsQuery) ExecuteStreamed(ctx context.Context, req *openfgav1.StreamedListObjectsRequest, srv openfgav1.OpenFGAService_StreamedListObjectsServer) (*ListObjectsResolutionMetadata, error)
ExecuteStreamed executes the ListObjectsQuery, returning a stream of object IDs. It ignores the value of q.listObjectsMaxResults and returns all available results until q.listObjectsDeadline is hit.
type ListObjectsQueryOption ¶ added in v1.3.0
type ListObjectsQueryOption func(d *ListObjectsQuery)
func WithDispatchThrottlerConfig ¶ added in v1.5.4
func WithDispatchThrottlerConfig(config threshold.Config) ListObjectsQueryOption
func WithListObjectsDeadline ¶ added in v1.3.0
func WithListObjectsDeadline(deadline time.Duration) ListObjectsQueryOption
func WithListObjectsMaxResults ¶ added in v1.3.0
func WithListObjectsMaxResults(max uint32) ListObjectsQueryOption
func WithLogger ¶ added in v1.3.0
func WithLogger(l logger.Logger) ListObjectsQueryOption
func WithMaxConcurrentReads ¶ added in v1.3.0
func WithMaxConcurrentReads(limit uint32) ListObjectsQueryOption
WithMaxConcurrentReads see server.WithMaxConcurrentReadsForListObjects.
func WithResolveNodeBreadthLimit ¶ added in v1.3.0
func WithResolveNodeBreadthLimit(limit uint32) ListObjectsQueryOption
WithResolveNodeBreadthLimit see server.WithResolveNodeBreadthLimit.
func WithResolveNodeLimit ¶ added in v1.3.0
func WithResolveNodeLimit(limit uint32) ListObjectsQueryOption
WithResolveNodeLimit see server.WithResolveNodeLimit.
type ListObjectsResolutionMetadata ¶ added in v1.5.1
type ListObjectsResolutionMetadata struct { // The total number of database reads from reverse_expand and Check (if any) to complete the ListObjects request DatastoreQueryCount *atomic.Uint32 // The total number of dispatches aggregated from reverse_expand and check resolutions (if any) to complete the ListObjects request DispatchCounter *atomic.Uint32 // WasThrottled indicates whether the request was throttled WasThrottled *atomic.Bool }
func NewListObjectsResolutionMetadata ¶ added in v1.5.1
func NewListObjectsResolutionMetadata() *ListObjectsResolutionMetadata
type ListObjectsResponse ¶ added in v1.3.2
type ListObjectsResponse struct { Objects []string ResolutionMetadata ListObjectsResolutionMetadata }
type ListObjectsResult ¶ added in v1.1.1
type ListStoresQuery ¶
type ListStoresQuery struct {
// contains filtered or unexported fields
}
func NewListStoresQuery ¶
func NewListStoresQuery(storesBackend storage.StoresBackend, opts ...ListStoresQueryOption) *ListStoresQuery
func (*ListStoresQuery) Execute ¶
func (q *ListStoresQuery) Execute(ctx context.Context, req *openfgav1.ListStoresRequest, storeIDs []string) (*openfgav1.ListStoresResponse, error)
type ListStoresQueryOption ¶ added in v1.3.8
type ListStoresQueryOption func(*ListStoresQuery)
func WithListStoresQueryEncoder ¶ added in v1.3.8
func WithListStoresQueryEncoder(e encoder.Encoder) ListStoresQueryOption
func WithListStoresQueryLogger ¶ added in v1.3.8
func WithListStoresQueryLogger(l logger.Logger) ListStoresQueryOption
type ReadAssertionsQuery ¶
type ReadAssertionsQuery struct {
// contains filtered or unexported fields
}
func NewReadAssertionsQuery ¶
func NewReadAssertionsQuery(backend storage.AssertionsBackend, opts ...ReadAssertionsQueryOption) *ReadAssertionsQuery
func (*ReadAssertionsQuery) Execute ¶
func (q *ReadAssertionsQuery) Execute(ctx context.Context, store, authorizationModelID string) (*openfgav1.ReadAssertionsResponse, error)
type ReadAssertionsQueryOption ¶ added in v1.3.8
type ReadAssertionsQueryOption func(*ReadAssertionsQuery)
func WithReadAssertionsQueryLogger ¶ added in v1.3.8
func WithReadAssertionsQueryLogger(l logger.Logger) ReadAssertionsQueryOption
type ReadAuthModelQueryOption ¶ added in v1.3.8
type ReadAuthModelQueryOption func(*ReadAuthorizationModelQuery)
func WithReadAuthModelQueryLogger ¶ added in v1.3.8
func WithReadAuthModelQueryLogger(l logger.Logger) ReadAuthModelQueryOption
type ReadAuthModelsQueryOption ¶ added in v1.3.8
type ReadAuthModelsQueryOption func(*ReadAuthorizationModelsQuery)
func WithReadAuthModelsQueryEncoder ¶ added in v1.3.8
func WithReadAuthModelsQueryEncoder(e encoder.Encoder) ReadAuthModelsQueryOption
func WithReadAuthModelsQueryLogger ¶ added in v1.3.8
func WithReadAuthModelsQueryLogger(l logger.Logger) ReadAuthModelsQueryOption
type ReadAuthorizationModelQuery ¶
type ReadAuthorizationModelQuery struct {
// contains filtered or unexported fields
}
ReadAuthorizationModelQuery retrieves a single type definition from a storage backend.
func NewReadAuthorizationModelQuery ¶
func NewReadAuthorizationModelQuery(backend storage.AuthorizationModelReadBackend, opts ...ReadAuthModelQueryOption) *ReadAuthorizationModelQuery
func (*ReadAuthorizationModelQuery) Execute ¶
func (q *ReadAuthorizationModelQuery) Execute(ctx context.Context, req *openfgav1.ReadAuthorizationModelRequest) (*openfgav1.ReadAuthorizationModelResponse, error)
type ReadAuthorizationModelsQuery ¶
type ReadAuthorizationModelsQuery struct {
// contains filtered or unexported fields
}
func NewReadAuthorizationModelsQuery ¶
func NewReadAuthorizationModelsQuery(backend storage.AuthorizationModelReadBackend, opts ...ReadAuthModelsQueryOption) *ReadAuthorizationModelsQuery
func (*ReadAuthorizationModelsQuery) Execute ¶
func (q *ReadAuthorizationModelsQuery) Execute(ctx context.Context, req *openfgav1.ReadAuthorizationModelsRequest) (*openfgav1.ReadAuthorizationModelsResponse, error)
type ReadChangesQuery ¶
type ReadChangesQuery struct {
// contains filtered or unexported fields
}
func NewReadChangesQuery ¶
func NewReadChangesQuery(backend storage.ChangelogBackend, opts ...ReadChangesQueryOption) *ReadChangesQuery
NewReadChangesQuery creates a ReadChangesQuery with specified `ChangelogBackend`.
func (*ReadChangesQuery) Execute ¶
func (q *ReadChangesQuery) Execute(ctx context.Context, req *openfgav1.ReadChangesRequest) (*openfgav1.ReadChangesResponse, error)
Execute the ReadChangesQuery, returning paginated `openfga.TupleChange`(s) and a possibly non-empty continuation token.
type ReadChangesQueryOption ¶ added in v1.3.8
type ReadChangesQueryOption func(*ReadChangesQuery)
func WithContinuationTokenSerializer ¶ added in v1.8.0
func WithContinuationTokenSerializer(tokenSerializer encoder.ContinuationTokenSerializer) ReadChangesQueryOption
WithContinuationTokenSerializer specifies the token serializer to be used.
func WithReadChangeQueryHorizonOffset ¶ added in v1.3.8
func WithReadChangeQueryHorizonOffset(horizonOffset int) ReadChangesQueryOption
WithReadChangeQueryHorizonOffset specifies duration in minutes.
func WithReadChangesQueryEncoder ¶ added in v1.3.8
func WithReadChangesQueryEncoder(e encoder.Encoder) ReadChangesQueryOption
func WithReadChangesQueryLogger ¶ added in v1.3.8
func WithReadChangesQueryLogger(l logger.Logger) ReadChangesQueryOption
type ReadQuery ¶
type ReadQuery struct {
// contains filtered or unexported fields
}
A ReadQuery can be used to read one or many tuplesets Each tupleset specifies keys of a set of relation tuples. The set can include a single tuple key, or all tuples with a given object ID or userset in a type, optionally constrained by a relation name.
func NewReadQuery ¶
func NewReadQuery(datastore storage.OpenFGADatastore, opts ...ReadQueryOption) *ReadQuery
NewReadQuery creates a ReadQuery using the provided OpenFGA datastore implementation.
func (*ReadQuery) Execute ¶
func (q *ReadQuery) Execute(ctx context.Context, req *openfgav1.ReadRequest) (*openfgav1.ReadResponse, error)
Execute the ReadQuery, returning paginated `openfga.Tuple`(s) that match the tuple. Return all tuples if the tuple is nil or empty.
type ReadQueryOption ¶ added in v1.3.8
type ReadQueryOption func(*ReadQuery)
func WithReadQueryEncoder ¶ added in v1.3.8
func WithReadQueryEncoder(e encoder.Encoder) ReadQueryOption
func WithReadQueryLogger ¶ added in v1.3.8
func WithReadQueryLogger(l logger.Logger) ReadQueryOption
func WithReadQueryTokenSerializer ¶ added in v1.8.0
func WithReadQueryTokenSerializer(serializer encoder.ContinuationTokenSerializer) ReadQueryOption
type ThrottledError ¶ added in v1.7.0
type ThrottledError struct {
Cause error
}
func (*ThrottledError) Error ¶ added in v1.7.0
func (e *ThrottledError) Error() string
func (*ThrottledError) Unwrap ¶ added in v1.7.0
func (e *ThrottledError) Unwrap() error
type WriteAssertionsCmdOption ¶ added in v1.3.8
type WriteAssertionsCmdOption func(*WriteAssertionsCommand)
func WithWriteAssertCmdLogger ¶ added in v1.3.8
func WithWriteAssertCmdLogger(l logger.Logger) WriteAssertionsCmdOption
type WriteAssertionsCommand ¶
type WriteAssertionsCommand struct {
// contains filtered or unexported fields
}
func NewWriteAssertionsCommand ¶
func NewWriteAssertionsCommand( datastore storage.OpenFGADatastore, opts ...WriteAssertionsCmdOption) *WriteAssertionsCommand
func (*WriteAssertionsCommand) Execute ¶
func (w *WriteAssertionsCommand) Execute(ctx context.Context, req *openfgav1.WriteAssertionsRequest) (*openfgav1.WriteAssertionsResponse, error)
type WriteAuthModelOption ¶ added in v1.3.8
type WriteAuthModelOption func(*WriteAuthorizationModelCommand)
func WithWriteAuthModelLogger ¶ added in v1.3.8
func WithWriteAuthModelLogger(l logger.Logger) WriteAuthModelOption
func WithWriteAuthModelMaxSizeInBytes ¶ added in v1.3.8
func WithWriteAuthModelMaxSizeInBytes(size int) WriteAuthModelOption
type WriteAuthorizationModelCommand ¶
type WriteAuthorizationModelCommand struct {
// contains filtered or unexported fields
}
WriteAuthorizationModelCommand performs updates of the store authorization model.
func NewWriteAuthorizationModelCommand ¶
func NewWriteAuthorizationModelCommand(backend storage.TypeDefinitionWriteBackend, opts ...WriteAuthModelOption) *WriteAuthorizationModelCommand
func (*WriteAuthorizationModelCommand) Execute ¶
func (w *WriteAuthorizationModelCommand) Execute(ctx context.Context, req *openfgav1.WriteAuthorizationModelRequest) (*openfgav1.WriteAuthorizationModelResponse, error)
Execute the command using the supplied request.
type WriteCommand ¶
type WriteCommand struct {
// contains filtered or unexported fields
}
WriteCommand is used to Write and Delete tuples. Instances may be safely shared by multiple goroutines.
func NewWriteCommand ¶
func NewWriteCommand(datastore storage.OpenFGADatastore, opts ...WriteCommandOption) *WriteCommand
NewWriteCommand creates a WriteCommand with specified storage.OpenFGADatastore to use for storage.
func (*WriteCommand) Execute ¶
func (c *WriteCommand) Execute(ctx context.Context, req *openfgav1.WriteRequest) (*openfgav1.WriteResponse, error)
Execute deletes and writes the specified tuples. Deletes are applied first, then writes.
type WriteCommandOption ¶ added in v1.3.8
type WriteCommandOption func(*WriteCommand)
func WithConditionContextByteLimit ¶ added in v1.3.8
func WithConditionContextByteLimit(limit int) WriteCommandOption
func WithWriteCmdLogger ¶ added in v1.3.8
func WithWriteCmdLogger(l logger.Logger) WriteCommandOption
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package reverseexpand contains the code that handles the ReverseExpand API
|
Package reverseexpand contains the code that handles the ReverseExpand API |