memory

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: 1

Documentation

Overview

Package memory contains an implementation of the storage interface that lives in memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

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 (s *MemoryBackend) CreateStore(ctx context.Context, newStore *openfgav1.Store) (*openfgav1.Store, error)

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) GetStore

func (s *MemoryBackend) GetStore(ctx context.Context, storeID string) (*openfgav1.Store, error)

func (*MemoryBackend) IsReady

func (s *MemoryBackend) IsReady(ctx context.Context) (bool, error)

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

Read See storage.TupleBackend.Read

func (*MemoryBackend) ReadAssertions

func (s *MemoryBackend) ReadAssertions(ctx context.Context, store, modelID string) ([]*openfgav1.Assertion, error)

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) ReadPage

func (s *MemoryBackend) ReadPage(ctx context.Context, store string, key *openfgav1.TupleKey, paginationOptions storage.PaginationOptions) ([]*openfgav1.Tuple, []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 (s *MemoryBackend) WriteAssertions(ctx context.Context, store, modelID string, assertions []*openfgav1.Assertion) error

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

Jump to

Keyboard shortcuts

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