keys

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EngineKeyManager added in v0.3.5

type EngineKeyManager interface {
	// SetCheckKey sets the value for the given key in the cache. It takes a PermissionCheckRequest
	// as the key and a PermissionCheckResponse as the value to be stored. It returns a boolean
	// value indicating whether the operation was successful or not.
	SetCheckKey(key *base.PermissionCheckRequest, decision *base.PermissionCheckResponse) bool

	// GetCheckKey retrieves the value for the given key from the cache. It takes a
	// PermissionCheckRequest as the key and returns the corresponding PermissionCheckResponse
	// if the key is found, along with a boolean value indicating whether the key was found or not.
	GetCheckKey(key *base.PermissionCheckRequest) (*base.PermissionCheckResponse, bool)
}

EngineKeyManager is an interface that defines the methods required for managing engine keys, specifically for caching permission check requests and responses.

func NewCheckEngineKeys added in v0.3.5

func NewCheckEngineKeys(cache cache.Cache) EngineKeyManager

NewCheckEngineKeys creates a new instance of EngineKeyManager by initializing an EngineKeys struct with the provided cache.Cache instance.

func NewNoopCheckEngineKeys added in v0.3.5

func NewNoopCheckEngineKeys() EngineKeyManager

NewNoopCheckEngineKeys creates a new noop instance of EngineKeyManager by initializing a NoopEngineKeys struct. This instance will not perform any caching.

type EngineKeys added in v0.3.5

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

EngineKeys is a struct that holds an instance of a cache.Cache for managing engine keys.

func (*EngineKeys) GetCheckKey added in v0.3.5

GetCheckKey retrieves the value for the given key from the EngineKeys cache. It returns the PermissionCheckResponse if the key is found, and a boolean value indicating whether the key was found or not.

func (*EngineKeys) SetCheckKey added in v0.3.5

SetCheckKey sets the value for the given key in the EngineKeys cache. It returns true if the operation is successful, false otherwise.

type NoopEngineKeys added in v0.3.5

type NoopEngineKeys struct{}

NoopEngineKeys is an empty struct that implements the EngineKeyManager interface with no-op (no operation) methods, meaning they do not perform any real work or caching.

func (*NoopEngineKeys) GetCheckKey added in v0.3.5

GetCheckKey is a no-op method that implements the GetCheckKey method for the EngineKeyManager interface. It always returns nil and false, indicating that the key is not found, as it performs no actual caching or operations.

func (*NoopEngineKeys) SetCheckKey added in v0.3.5

SetCheckKey is a no-op method that implements the SetCheckKey method for the EngineKeyManager interface. It always returns true, indicating success, but performs no actual caching or operations.

Jump to

Keyboard shortcuts

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