storecache

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 3

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(config *Config) *Cache

func (*Cache) GetStaleEntries

func (c *Cache) GetStaleEntries() []*cache.StaleEntry

GetStaleEntries obtains a list of stale entries, that needs new SVIDs

func (*Cache) HandledRecord

func (c *Cache) HandledRecord(handledEntry *common.RegistrationEntry, revision int64)

HandledRecord updates handled revision, and sets the latests processed entry

func (*Cache) ReadyToStore

func (c *Cache) ReadyToStore() []*Record

ReadyToStore returns all records that are ready to be stored

func (*Cache) Records

func (c *Cache) Records() []*Record

Records returns all the records in the cache. This function exists only to facilitate testing.

func (*Cache) UpdateEntries

func (c *Cache) UpdateEntries(update *cache.UpdateEntries, checkSVID func(*common.RegistrationEntry, *common.RegistrationEntry, *cache.X509SVID) bool)

UpdateEntries using `UpdateEntries` updates and validates latests entries, record's revision number is incremented on each record baed on: - Knowledge or when the SVID for that entry changes - Knowledge when the bundle changes - Knowledge when a federated bundle related to an storable entry changes

func (*Cache) UpdateSVIDs

func (c *Cache) UpdateSVIDs(update *cache.UpdateSVIDs)

UpdateSVIDs updates cache with latests SVIDs

type Config

type Config struct {
	Log         logrus.FieldLogger
	TrustDomain spiffeid.TrustDomain
}

Config is the store cache configuration

type Record

type Record struct {
	// ID holds entry ID
	ID string
	// Entry holds registration entry for record
	Entry *common.RegistrationEntry
	// ExpiresAt is the expiration time for SVID
	ExpiresAt time.Time
	// Svid holds a valid X509-SVID
	Svid *cache.X509SVID
	// Revision is the current cache record version
	Revision int64
	// Bundles holds trust domain bundle together with federated bundle
	Bundles map[spiffeid.TrustDomain]*spiffebundle.Bundle
	// HandledEntry holds the previous entry revision. It is useful to define
	// what changed between versions.
	HandledEntry *common.RegistrationEntry
}

Record holds the latests cached SVID with its context

Jump to

Keyboard shortcuts

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