cache

package
v0.33.26 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 13 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 Cache

type Cache struct {
	// contains filtered or unexported fields
}

func New

func New(m *model.Model) *Cache

New, create new model cache instance.

func (*Cache) AssignableRelations

func (c *Cache) AssignableRelations(on, sn ObjectName, sr ...RelationName) ([]RelationName, error)

AssignableRelations returns the set of relations that can occur between a given object type and a subject type, optionally with a subject relation.

If more than one subject relation is provided, AssignableRelations returns relations that match any of the given relations. For example, if the manifest has:

types:

tenant:
  relations:
    admin: group#member
    guest: group#guest

Then AssignableRelations("tenant", "group", "member", "guest") returns ["admin", "guest"].

func (*Cache) AvailablePermissions

func (c *Cache) AvailablePermissions(on, sn ObjectName, sr ...RelationName) ([]RelationName, error)

AvailablePermissions returns the set of permissions that a given subject type can have on an object type, optionally with a subject relation.

If more than one subject relation is provided, AvailablePermissions returns permissions that match any of the given relations.

func (*Cache) CanUpdate

func (c *Cache) CanUpdate(other *model.Model, stats *stts.Stats) error

func (*Cache) Check

func (c *Cache) Check(req *dsr.CheckRequest, relReader graph.RelationReader) (*dsr.CheckResponse, error)

func (*Cache) GetGraph

func (c *Cache) GetGraph(req *dsr.GetGraphRequest, relReader graph.RelationReader) (*dsr.GetGraphResponse, error)

func (*Cache) Metadata

func (c *Cache) Metadata() *model.Metadata

func (*Cache) ObjectExists

func (c *Cache) ObjectExists(on ObjectName) bool

ObjectExists, checks if given object type name exists in the model cache.

func (*Cache) PermissionExists

func (c *Cache) PermissionExists(on ObjectName, pn RelationName) bool

PermissionExists, checks if given permission, for the given object type, exists in the model cache.

func (*Cache) RelationExists

func (c *Cache) RelationExists(on ObjectName, rn RelationName) bool

RelationExists, checks if given relation type, for the given object type, exists in the model cache.

func (*Cache) UpdateModel

func (c *Cache) UpdateModel(m *model.Model) error

UpdateModel, swaps the cache model instance.

func (*Cache) ValidateRelation

func (c *Cache) ValidateRelation(relation *dsc.RelationIdentifier) error

type ObjectName

type ObjectName = model.ObjectName

type RelationName

type RelationName = model.RelationName

Jump to

Keyboard shortcuts

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