Documentation
¶
Overview ¶
Package authorizationcache provides explicit advisory cache adapters for portable policy manifests. Cached manifests never replace repository verification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrManifestTooLarge reports that an encoded manifest exceeds the configured bound. ErrManifestTooLarge = errors.New("authorization cached manifest is too large") // ErrInvalidRevision reports that a zero revision cannot be used as a cache key. ErrInvalidRevision = errors.New("authorization cached revision is invalid") // ErrNilRepository reports that RepositoryLoader received no policy repository. ErrNilRepository = errors.New("authorization cached repository is nil") )
Functions ¶
func RepositoryLoader ¶
func RepositoryLoader( repository policy.Repository, ) (cache.Loader[authorization.Revision, policy.Manifest], error)
RepositoryLoader returns a loader that reports a hit only for the repository's exact current revision.
Types ¶
type Config ¶
type Config struct {
// Namespace isolates keys owned by this application.
Namespace string
// Backend stores encoded cache entries and retains ownership of its resources.
Backend cache.Backend
// TTL controls entry expiration.
TTL cache.TTLPolicy
// Clock supplies cache time behavior.
Clock cache.Clock
// Observer receives bounded cache operation observations.
Observer cache.Observer
// MaxValue bounds an encoded manifest; zero uses the package default.
MaxValue int
// MaxBatch bounds multi-key cache operations.
MaxBatch int
// MaxKeySize bounds encoded cache keys; zero uses the package default.
MaxKeySize int
}
Config configures an advisory manifest cache and its resource bounds.
type ManifestCodec ¶
type ManifestCodec struct {
// MaxEncodedSize is the byte limit; non-positive values use the package default.
MaxEncodedSize int
}
ManifestCodec encodes and decodes policy manifests with a bounded encoded size.
type RevisionKeyEncoder ¶
type RevisionKeyEncoder struct{}
RevisionKeyEncoder encodes non-zero policy revisions as stable decimal cache keys.
func (RevisionKeyEncoder) EncodeKey ¶
func (RevisionKeyEncoder) EncodeKey(revision authorization.Revision) ([]byte, error)
EncodeKey returns revision's decimal representation or ErrInvalidRevision for zero.
Click to show internal directories.
Click to hide internal directories.