cache

package
v0.0.0-...-8f69376 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(log logrus.FieldLogger, trustDomain string, bundle *Bundle) *cacheImpl

New creates a new Cache.

func NewSubscriber

func NewSubscriber(selectors Selectors) (*subscriber, error)

func NewSubscribers

func NewSubscribers() *subscribers

Types

type Bundle

type Bundle = bundleutil.Bundle

type BundleStream

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

Wraps an observer stream to provide a type safe interface

func NewBundleStream

func NewBundleStream(stream observer.Stream) *BundleStream

func (*BundleStream) Changes

func (b *BundleStream) Changes() chan struct{}

Changes returns the channel that is closed when a new value is available.

func (*BundleStream) Clone

func (b *BundleStream) Clone() *BundleStream

Clone creates a new independent stream from this one but sharing the same Property. Updates to the property will be reflected in both streams but they may have different values depending on when they advance the stream with Next.

func (*BundleStream) HasNext

func (b *BundleStream) HasNext() bool

HasNext checks whether there is a new value available.

func (*BundleStream) Next

func (b *BundleStream) Next() map[string]*Bundle

Next advances this stream to the next state. You should never call this unless Changes channel is closed.

func (*BundleStream) Value

func (b *BundleStream) Value() map[string]*Bundle

Value returns the current value for this stream.

func (*BundleStream) WaitNext

func (b *BundleStream) WaitNext() map[string]*Bundle

WaitNext waits for Changes to be closed, advances the stream and returns the current value.

type Cache

type Cache interface {
	// FetchEntry gets the cache entry for the specified registration entry id
	FetchEntry(entryId string) *Entry
	// SetEntry puts a new cache entry for the entry's RegistrationEntry.
	SetEntry(entry *Entry)
	// DeleteEntry removes the cache entry for the specified RegistrationEntry if it exists,
	// returns true if it removed some entry or false otherwise.
	DeleteEntry(regEntry *common.RegistrationEntry) bool
	// Entries returns all the in force cached entries.
	Entries() []*Entry
	// Registers and returns a Subscriber, and then sends latest WorkloadUpdate on its channel
	Subscribe(selectors Selectors) Subscriber
	// Set the bundles
	SetBundles(map[string]*Bundle)
	// Retrieve the bundle for the trust domain
	Bundle() *Bundle
	// SubscribeToBundleChanges returns a bundle stream. Each
	// time bundles are updated, a new bundle mapping is streamed.
	SubscribeToBundleChanges() *BundleStream
	// FetchWorkloadUpdates gets the latest workload update for the selectors
	FetchWorkloadUpdate(selectors Selectors) *WorkloadUpdate

	// GetJWTSVID retrieves a cached JWT SVID based on the subject and
	// intended audience.
	GetJWTSVID(spiffeID string, audience []string) (*client.JWTSVID, bool)
	// SetJWTSVID caches a JWT SVID based on the subject and intended audience.
	SetJWTSVID(spiffeID string, audience []string, svid *client.JWTSVID)
}

type Entry

type Entry struct {
	RegistrationEntry *common.RegistrationEntry
	SVID              []*x509.Certificate
	PrivateKey        *ecdsa.PrivateKey
}

Entry holds the data of a single cache entry.

type Selectors

type Selectors []*common.Selector

type Subscriber

type Subscriber interface {
	Updates() <-chan *WorkloadUpdate
	Finish()
}

type WorkloadUpdate

type WorkloadUpdate struct {
	Entries          []*Entry
	Bundle           *Bundle
	FederatedBundles map[string]*Bundle
}

Jump to

Keyboard shortcuts

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