memory

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 New

func New(maxTuplesPerWrite int, maxTypesPerAuthorizationModel int) *MemoryBackend

New creates a new empty MemoryBackend.

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 *openfgapb.Store) (*openfgapb.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) (*openfgapb.Store, error)

func (*MemoryBackend) IsReady

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

func (*MemoryBackend) ListObjectsByType

func (s *MemoryBackend) ListObjectsByType(ctx context.Context, store string, objectType string) (storage.ObjectIterator, error)

func (*MemoryBackend) ListStores

func (s *MemoryBackend) ListStores(ctx context.Context, paginationOptions storage.PaginationOptions) ([]*openfgapb.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) ([]*openfgapb.Assertion, error)

func (*MemoryBackend) ReadAuthorizationModel

func (s *MemoryBackend) ReadAuthorizationModel(ctx context.Context, store string, id string) (*openfgapb.AuthorizationModel, error)

ReadAuthorizationModel See storage.AuthorizationModelBackend.ReadAuthorizationModel

func (*MemoryBackend) ReadAuthorizationModels

func (s *MemoryBackend) ReadAuthorizationModels(ctx context.Context, store string, options storage.PaginationOptions) ([]*openfgapb.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) ([]*openfgapb.TupleChange, []byte, error)

func (*MemoryBackend) ReadPage

func (s *MemoryBackend) ReadPage(ctx context.Context, store string, key *openfgapb.TupleKey, paginationOptions storage.PaginationOptions) ([]*openfgapb.Tuple, []byte, error)

func (*MemoryBackend) ReadStartingWithUser

func (s *MemoryBackend) ReadStartingWithUser(
	ctx context.Context,
	store string,
	filter storage.ReadStartingWithUserFilter,
) (storage.TupleIterator, error)

func (*MemoryBackend) ReadTypeDefinition

func (s *MemoryBackend) ReadTypeDefinition(ctx context.Context, store, id, objectType string) (*openfgapb.TypeDefinition, error)

ReadTypeDefinition See storage.TypeDefinitionReadBackend.ReadTypeDefinition

func (*MemoryBackend) ReadUserTuple

func (s *MemoryBackend) ReadUserTuple(ctx context.Context, store string, key *openfgapb.TupleKey) (*openfgapb.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 []*openfgapb.Assertion) error

func (*MemoryBackend) WriteAuthorizationModel

func (s *MemoryBackend) WriteAuthorizationModel(ctx context.Context, store string, model *openfgapb.AuthorizationModel) error

WriteAuthorizationModel See storage.TypeDefinitionWriteBackend.WriteAuthorizationModel

Jump to

Keyboard shortcuts

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