storagewrappers

package
v1.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package storagewrappers contains decorators for storage data

Index

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 (*ContextTracerWrapper) ReadPage

func (c *ContextTracerWrapper) ReadPage(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, opts storage.PaginationOptions) ([]*openfgav1.Tuple, []byte, error)

func (*ContextTracerWrapper) ReadStartingWithUser

func (*ContextTracerWrapper) ReadUserTuple

func (c *ContextTracerWrapper) ReadUserTuple(ctx context.Context, store string, tupleKey *openfgav1.TupleKey) (*openfgav1.Tuple, error)

func (*ContextTracerWrapper) ReadUsersetTuples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL