memory

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 127

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryManager

type MemoryManager struct {
	Policies map[string]Policy
	sync.RWMutex
}

MemoryManager is an in-memory (non-persistent) implementation of Manager.

func NewMemoryManager

func NewMemoryManager() *MemoryManager

NewMemoryManager constructs and initializes new MemoryManager with no policies.

func (*MemoryManager) Create

func (m *MemoryManager) Create(ctx context.Context, policy Policy) error

Create a new pollicy to MemoryManager.

func (*MemoryManager) Delete

func (m *MemoryManager) Delete(ctx context.Context, id string) error

Delete removes a policy.

func (*MemoryManager) FindPoliciesForResource added in v1.0.0

func (m *MemoryManager) FindPoliciesForResource(ctx context.Context, resource string) (Policies, error)

FindPoliciesForResource returns policies that could match the resource. It either returns a set of policies that apply to the resource, or a superset of it. If an error occurs, it returns nil and the error.

func (*MemoryManager) FindPoliciesForSubject added in v1.0.0

func (m *MemoryManager) FindPoliciesForSubject(ctx context.Context, subject string) (Policies, error)

FindPoliciesForSubject returns policies that could match the subject. It either returns a set of policies that applies to the subject, or a superset of it. If an error occurs, it returns nil and the error.

func (*MemoryManager) FindRequestCandidates

func (m *MemoryManager) FindRequestCandidates(ctx context.Context, r *Request) (Policies, error)

FindRequestCandidates returns candidates that could match the request object. It either returns a set that exactly matches the request, or a superset of it. If an error occurs, it returns nil and the error.

func (*MemoryManager) Get

func (m *MemoryManager) Get(ctx context.Context, id string) (Policy, error)

Get retrieves a policy.

func (*MemoryManager) GetAll

func (m *MemoryManager) GetAll(ctx context.Context, limit, offset int64) (Policies, error)

GetAll returns all policies.

func (*MemoryManager) Update added in v0.8.0

func (m *MemoryManager) Update(ctx context.Context, policy Policy) error

Update updates an existing policy.

Jump to

Keyboard shortcuts

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