cache

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

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) CanUpdate added in v0.1.0

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

func (*Cache) Check added in v0.1.0

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

func (*Cache) ExpandPermission

func (c *Cache) ExpandPermission(on model.ObjectName, pn model.RelationName) []model.RelationName

ExpandPermission returns list of relations which cover the given permission for the given object type.

func (*Cache) ExpandRelation

func (c *Cache) ExpandRelation(on model.ObjectName, rn model.RelationName) []model.RelationName

ExpandRelation, returns list of relations which are a union of the given relation. For example, when a writer relation inherits reader, the expansion of a reader = reader + writer.

func (*Cache) GetGraph added in v0.1.1

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

func (*Cache) GetObjectType

func (c *Cache) GetObjectType(objectType string) (*dsc2.ObjectType, error)

GetObjectType, v2 backwards-compatibility accessor function, returns v2 ObjectType by name.

func (*Cache) GetObjectTypes

func (c *Cache) GetObjectTypes() (ObjectTypeSlice, error)

GetObjectTypes, v2 backwards-compatibility accessor function, returns list of v2.ObjectType instances.

func (*Cache) GetPermission

func (c *Cache) GetPermission(permission string) (*dsc2.Permission, error)

GetPermission, v2 backwards-compatibility accessor function, returns v2 Permission by permission name.

func (*Cache) GetPermissions

func (c *Cache) GetPermissions() (PermissionSlice, error)

GetPermissions, v2 backwards-compatibility accessor function, returns list of v2 Permission instances.

func (*Cache) GetRelationType

func (c *Cache) GetRelationType(objectType, relation string) (*dsc2.RelationType, error)

GetRelationType, v2 backwards-compatibility accessor function, returns v2 RelationType by object type and relation name.

func (*Cache) GetRelationTypes

func (c *Cache) GetRelationTypes(objectType string) (RelationTypeSlice, error)

GetRelationTypes, v2 backwards-compatibility accessor function, returns list of v2 RelationType instances, optionally filtered by by object type.

func (*Cache) Metadata added in v0.0.17

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

func (*Cache) ObjectExists

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

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

func (*Cache) PermissionExists

func (c *Cache) PermissionExists(on model.ObjectName, pn model.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 model.ObjectName, rn model.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 added in v0.1.0

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

type ObjectTypeSlice added in v0.0.4

type ObjectTypeSlice []*dsc2.ObjectType

func (ObjectTypeSlice) Paginate added in v0.0.4

type PermissionSlice added in v0.0.4

type PermissionSlice []*dsc2.Permission

func (PermissionSlice) Paginate added in v0.0.4

type RelationTypeSlice added in v0.0.4

type RelationTypeSlice []*dsc2.RelationType

func (RelationTypeSlice) Paginate added in v0.0.4

Jump to

Keyboard shortcuts

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