Documentation ¶
Overview ¶
Package memory contains an implementation of the storage interface that lives in memory.
Index ¶
- func New(opts ...StorageOption) storage.OpenFGADatastore
- type AuthorizationModelEntry
- type MemoryBackend
- func (s *MemoryBackend) Close()
- func (s *MemoryBackend) CreateStore(ctx context.Context, newStore *openfgav1.Store) (*openfgav1.Store, error)
- func (s *MemoryBackend) DeleteStore(ctx context.Context, id string) error
- func (s *MemoryBackend) FindLatestAuthorizationModelID(ctx context.Context, store string) (string, error)
- func (s *MemoryBackend) GetStore(ctx context.Context, storeID string) (*openfgav1.Store, error)
- func (s *MemoryBackend) IsReady(ctx context.Context) (bool, error)
- func (s *MemoryBackend) ListStores(ctx context.Context, paginationOptions storage.PaginationOptions) ([]*openfgav1.Store, []byte, error)
- func (s *MemoryBackend) MaxTuplesPerWrite() int
- func (s *MemoryBackend) MaxTypesPerAuthorizationModel() int
- func (s *MemoryBackend) Read(ctx context.Context, store string, key *openfgav1.TupleKey) (storage.TupleIterator, error)
- func (s *MemoryBackend) ReadAssertions(ctx context.Context, store, modelID string) ([]*openfgav1.Assertion, error)
- func (s *MemoryBackend) ReadAuthorizationModel(ctx context.Context, store string, id string) (*openfgav1.AuthorizationModel, error)
- func (s *MemoryBackend) ReadAuthorizationModels(ctx context.Context, store string, options storage.PaginationOptions) ([]*openfgav1.AuthorizationModel, []byte, error)
- func (s *MemoryBackend) ReadChanges(ctx context.Context, store, objectType string, ...) ([]*openfgav1.TupleChange, []byte, error)
- func (s *MemoryBackend) ReadPage(ctx context.Context, store string, key *openfgav1.TupleKey, ...) ([]*openfgav1.Tuple, []byte, error)
- func (s *MemoryBackend) ReadStartingWithUser(ctx context.Context, store string, filter storage.ReadStartingWithUserFilter) (storage.TupleIterator, error)
- func (s *MemoryBackend) ReadUserTuple(ctx context.Context, store string, key *openfgav1.TupleKey) (*openfgav1.Tuple, error)
- func (s *MemoryBackend) ReadUsersetTuples(ctx context.Context, store string, filter storage.ReadUsersetTuplesFilter) (storage.TupleIterator, error)
- func (s *MemoryBackend) Write(ctx context.Context, store string, deletes storage.Deletes, ...) error
- func (s *MemoryBackend) WriteAssertions(ctx context.Context, store, modelID string, assertions []*openfgav1.Assertion) error
- func (s *MemoryBackend) WriteAuthorizationModel(ctx context.Context, store string, model *openfgav1.AuthorizationModel) error
- type StorageOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...StorageOption) storage.OpenFGADatastore
New creates a new empty MemoryBackend.
Types ¶
type AuthorizationModelEntry ¶
type AuthorizationModelEntry struct {
// contains filtered or unexported fields
}
type MemoryBackend ¶
type MemoryBackend struct {
// contains filtered or unexported fields
}
A MemoryBackend provides an ephemeral memory-backed implementation of TupleBackend and AuthorizationModelBackend. MemoryBackend instances may be safely shared by multiple go-routines.
func (*MemoryBackend) Close ¶
func (s *MemoryBackend) Close()
Close closes any open connections and cleans up residual resources used by this storage adapter instance.
func (*MemoryBackend) CreateStore ¶
func (*MemoryBackend) DeleteStore ¶
func (s *MemoryBackend) DeleteStore(ctx context.Context, id string) error
func (*MemoryBackend) FindLatestAuthorizationModelID ¶
func (s *MemoryBackend) FindLatestAuthorizationModelID(ctx context.Context, store string) (string, error)
FindLatestAuthorizationModelID See storage.AuthorizationModelBackend.FindLatestAuthorizationModelID
func (*MemoryBackend) ListStores ¶
func (s *MemoryBackend) ListStores(ctx context.Context, paginationOptions storage.PaginationOptions) ([]*openfgav1.Store, []byte, error)
func (*MemoryBackend) MaxTuplesPerWrite ¶
func (s *MemoryBackend) MaxTuplesPerWrite() int
MaxTuplesPerWrite returns the maximum number of tuples allowed in one write operation
func (*MemoryBackend) MaxTypesPerAuthorizationModel ¶
func (s *MemoryBackend) MaxTypesPerAuthorizationModel() int
MaxTypesPerAuthorizationModel returns the maximum number of types allowed in a type definition
func (*MemoryBackend) Read ¶
func (s *MemoryBackend) Read(ctx context.Context, store string, key *openfgav1.TupleKey) (storage.TupleIterator, error)
Read See storage.TupleBackend.Read
func (*MemoryBackend) ReadAssertions ¶
func (*MemoryBackend) ReadAuthorizationModel ¶
func (s *MemoryBackend) ReadAuthorizationModel(ctx context.Context, store string, id string) (*openfgav1.AuthorizationModel, error)
ReadAuthorizationModel See storage.AuthorizationModelBackend.ReadAuthorizationModel
func (*MemoryBackend) ReadAuthorizationModels ¶
func (s *MemoryBackend) ReadAuthorizationModels(ctx context.Context, store string, options storage.PaginationOptions) ([]*openfgav1.AuthorizationModel, []byte, error)
ReadAuthorizationModels See storage.AuthorizationModelBackend.ReadAuthorizationModels options.From is expected to be a number
func (*MemoryBackend) ReadChanges ¶
func (s *MemoryBackend) ReadChanges(ctx context.Context, store, objectType string, paginationOptions storage.PaginationOptions, horizonOffset time.Duration) ([]*openfgav1.TupleChange, []byte, error)
func (*MemoryBackend) ReadStartingWithUser ¶
func (s *MemoryBackend) ReadStartingWithUser( ctx context.Context, store string, filter storage.ReadStartingWithUserFilter, ) (storage.TupleIterator, error)
func (*MemoryBackend) ReadUserTuple ¶
func (s *MemoryBackend) ReadUserTuple(ctx context.Context, store string, key *openfgav1.TupleKey) (*openfgav1.Tuple, error)
ReadUserTuple See storage.TupleBackend.ReadUserTuple
func (*MemoryBackend) ReadUsersetTuples ¶
func (s *MemoryBackend) ReadUsersetTuples(ctx context.Context, store string, filter storage.ReadUsersetTuplesFilter) (storage.TupleIterator, error)
ReadUsersetTuples See storage.TupleBackend.ReadUsersetTuples
func (*MemoryBackend) Write ¶
func (s *MemoryBackend) Write(ctx context.Context, store string, deletes storage.Deletes, writes storage.Writes) error
Write See storage.TupleBackend.Write
func (*MemoryBackend) WriteAssertions ¶
func (*MemoryBackend) WriteAuthorizationModel ¶
func (s *MemoryBackend) WriteAuthorizationModel(ctx context.Context, store string, model *openfgav1.AuthorizationModel) error
WriteAuthorizationModel See storage.TypeDefinitionWriteBackend.WriteAuthorizationModel
type StorageOption ¶ added in v1.1.1
type StorageOption func(ds *MemoryBackend)
func WithMaxTuplesPerWrite ¶ added in v1.1.1
func WithMaxTuplesPerWrite(n int) StorageOption
func WithMaxTypesPerAuthorizationModel ¶ added in v1.1.1
func WithMaxTypesPerAuthorizationModel(n int) StorageOption