Documentation ¶
Index ¶
- type AuthorizationModelEntry
- type MemoryBackend
- func (s *MemoryBackend) Close()
- func (s *MemoryBackend) CreateStore(ctx context.Context, newStore *openfgapb.Store) (*openfgapb.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) (*openfgapb.Store, error)
- func (s *MemoryBackend) IsReady(ctx context.Context) (bool, error)
- func (s *MemoryBackend) ListObjectsByType(ctx context.Context, store string, objectType string) (storage.ObjectIterator, error)
- func (s *MemoryBackend) ListStores(ctx context.Context, paginationOptions storage.PaginationOptions) ([]*openfgapb.Store, []byte, error)
- func (s *MemoryBackend) MaxTuplesPerWrite() int
- func (s *MemoryBackend) MaxTypesPerAuthorizationModel() int
- func (s *MemoryBackend) Read(ctx context.Context, store string, key *openfgapb.TupleKey) (storage.TupleIterator, error)
- func (s *MemoryBackend) ReadAssertions(ctx context.Context, store, modelID string) ([]*openfgapb.Assertion, error)
- func (s *MemoryBackend) ReadAuthorizationModel(ctx context.Context, store string, id string) (*openfgapb.AuthorizationModel, error)
- func (s *MemoryBackend) ReadAuthorizationModels(ctx context.Context, store string, options storage.PaginationOptions) ([]*openfgapb.AuthorizationModel, []byte, error)
- func (s *MemoryBackend) ReadChanges(ctx context.Context, store, objectType string, ...) ([]*openfgapb.TupleChange, []byte, error)
- func (s *MemoryBackend) ReadPage(ctx context.Context, store string, key *openfgapb.TupleKey, ...) ([]*openfgapb.Tuple, []byte, error)
- func (s *MemoryBackend) ReadStartingWithUser(ctx context.Context, store string, filter storage.ReadStartingWithUserFilter) (storage.TupleIterator, error)
- func (s *MemoryBackend) ReadTypeDefinition(ctx context.Context, store, id, objectType string) (*openfgapb.TypeDefinition, error)
- func (s *MemoryBackend) ReadUserTuple(ctx context.Context, store string, key *openfgapb.TupleKey) (*openfgapb.Tuple, error)
- func (s *MemoryBackend) ReadUsersetTuples(ctx context.Context, store string, tk *openfgapb.TupleKey) (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 []*openfgapb.Assertion) error
- func (s *MemoryBackend) WriteAuthorizationModel(ctx context.Context, store string, model *openfgapb.AuthorizationModel) error
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 (*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) 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 ¶
func (s *MemoryBackend) Read(ctx context.Context, store string, key *openfgapb.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) (*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) 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, tk *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 (*MemoryBackend) WriteAuthorizationModel ¶
func (s *MemoryBackend) WriteAuthorizationModel(ctx context.Context, store string, model *openfgapb.AuthorizationModel) error
WriteAuthorizationModel See storage.TypeDefinitionWriteBackend.WriteAuthorizationModel