memory

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(tracer trace.Tracer, maxTuplesInOneWrite int, maxTypesInAuthorizationModel int) *MemoryBackend

New creates a new empty MemoryBackend.

func (*MemoryBackend) Close

func (s *MemoryBackend) Close(ctx context.Context) error

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

func (s *MemoryBackend) ListStores(ctx context.Context, paginationOptions storage.PaginationOptions) ([]*openfgapb.Store, []byte, error)

func (*MemoryBackend) MaxTuplesInWriteOperation

func (s *MemoryBackend) MaxTuplesInWriteOperation() int

MaxTuplesInWriteOperation returns the maximum number of tuples allowed in one write operation

func (*MemoryBackend) MaxTypesInTypeDefinition

func (s *MemoryBackend) MaxTypesInTypeDefinition() int

MaxTypesInTypeDefinition 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) ReadByStore

func (s *MemoryBackend) ReadByStore(ctx context.Context, store string, options storage.PaginationOptions) ([]*openfgapb.Tuple, []byte, error)

ReadByStore See storage.TupleBackend.ReadByStore

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) 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, key *openfgapb.TupleKey) (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, id string, tds *openfgapb.TypeDefinitions) error

WriteAuthorizationModel See storage.TypeDefinitionWriteBackend.WriteAuthorizationModel

Jump to

Keyboard shortcuts

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