Documentation ¶
Overview ¶
Package storagewrappers contains decorators for storage data
Index ¶
- func NewBoundedConcurrencyTupleReader(wrapped storage.RelationshipTupleReader, concurrency uint32) *boundedConcurrencyTupleReader
- func NewCachedOpenFGADatastore(inner storage.OpenFGADatastore, maxSize int) *cachedOpenFGADatastore
- func NewCombinedTupleReader(ds storage.RelationshipTupleReader, contextualTuples []*openfgav1.TupleKey) storage.RelationshipTupleReader
- type ContextTracerWrapper
- func (c *ContextTracerWrapper) Close()
- func (c *ContextTracerWrapper) Read(ctx context.Context, store string, tupleKey *openfgav1.TupleKey) (storage.TupleIterator, error)
- func (c *ContextTracerWrapper) ReadPage(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, ...) ([]*openfgav1.Tuple, []byte, error)
- func (c *ContextTracerWrapper) ReadStartingWithUser(ctx context.Context, store string, opts storage.ReadStartingWithUserFilter) (storage.TupleIterator, error)
- func (c *ContextTracerWrapper) ReadUserTuple(ctx context.Context, store string, tupleKey *openfgav1.TupleKey) (*openfgav1.Tuple, error)
- func (c *ContextTracerWrapper) ReadUsersetTuples(ctx context.Context, store string, filter storage.ReadUsersetTuplesFilter) (storage.TupleIterator, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBoundedConcurrencyTupleReader ¶
func NewBoundedConcurrencyTupleReader(wrapped storage.RelationshipTupleReader, concurrency uint32) *boundedConcurrencyTupleReader
NewBoundedConcurrencyTupleReader returns a wrapper over a datastore that makes sure that there are, at most, "concurrency" concurrent calls to Read, ReadUserTuple and ReadUsersetTuples. Consumers can then rest assured that one client will not hoard all the database connections available.
func NewCachedOpenFGADatastore ¶
func NewCachedOpenFGADatastore(inner storage.OpenFGADatastore, maxSize int) *cachedOpenFGADatastore
NewCachedOpenFGADatastore returns a wrapper over a datastore that caches up to maxSize *openfgav1.AuthorizationModel on every call to storage.ReadAuthorizationModel.
func NewCombinedTupleReader ¶
func NewCombinedTupleReader(ds storage.RelationshipTupleReader, contextualTuples []*openfgav1.TupleKey) storage.RelationshipTupleReader
NewCombinedTupleReader returns a TupleReader that reads from a persistent datastore and from the contextual tuples specified in the request
Types ¶
type ContextTracerWrapper ¶
type ContextTracerWrapper struct {
storage.OpenFGADatastore
}
ContextTracerWrapper is a wrapper around a datastore that passes a new context to the underlying datastore methods. This is so that if the original context gets cancelled (e.g by the client), the underlying database connection isn't closed. So, we let outstanding queries run their course even if the original context gets cancelled to avoid database connection churning.
ContextTracerWrapper must be the first wrapper around the datastore if traces are to work properly.
func NewContextWrapper ¶
func NewContextWrapper(inner storage.OpenFGADatastore) *ContextTracerWrapper
func (*ContextTracerWrapper) Close ¶
func (c *ContextTracerWrapper) Close()
func (*ContextTracerWrapper) Read ¶
func (c *ContextTracerWrapper) Read(ctx context.Context, store string, tupleKey *openfgav1.TupleKey) (storage.TupleIterator, error)
func (*ContextTracerWrapper) ReadStartingWithUser ¶
func (c *ContextTracerWrapper) ReadStartingWithUser(ctx context.Context, store string, opts storage.ReadStartingWithUserFilter) (storage.TupleIterator, error)
func (*ContextTracerWrapper) ReadUserTuple ¶
func (*ContextTracerWrapper) ReadUsersetTuples ¶
func (c *ContextTracerWrapper) ReadUsersetTuples(ctx context.Context, store string, filter storage.ReadUsersetTuplesFilter) (storage.TupleIterator, error)