entrycache

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent added in v0.12.0

type Agent struct {
	// ID is the Agent's SPIFFE ID.
	ID spiffeid.ID
	// Selectors is the Agent's selectors.
	Selectors []*types.Selector
}

Agent represents the association of selectors to an agent SPIFFE ID.

type AgentIterator added in v0.12.0

type AgentIterator interface {
	// Next returns true if there are any remaining agents in the data source and returns false otherwise.
	Next(ctx context.Context) bool
	// Agent returns the next agent from the data source.
	Agent() Agent
	// Err returns an error encountered when attempting to process agents from the data source.
	Err() error
}

AgentIterator is used to iterate through Agent selectors from a data source. The usage pattern of the iterator is as follows:

for it.Next() {
    agent := it.Agent()
    // process agent
}

if it.Err() {
    // handle error
}

type Cache added in v0.12.0

type Cache interface {
	GetAuthorizedEntries(agentID spiffeid.ID) []*types.Entry
}

Cache contains a snapshot of all registration entries and Agent selectors from the data source at a particular moment in time.

type EntryIterator added in v0.12.0

type EntryIterator interface {
	// Next returns true if there are any remaining registration entries in the data source and returns false otherwise.
	Next(ctx context.Context) bool
	// Entry returns the next entry from the data source.
	Entry() *types.Entry
	// Err returns an error encountered when attempting to process entries from the data source.
	Err() error
}

EntryIterator is used to iterate through registration entries from a data source. The usage pattern of the iterator is as follows:

for it.Next() {
    entry := it.Entry()
    // process entry
}

if it.Err() {
    // handle error
}

type FullEntryCache added in v0.12.0

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

func Build added in v0.12.0

func Build(ctx context.Context, entryIter EntryIterator, agentIter AgentIterator) (*FullEntryCache, error)

Build queries the data source for all registration entries and Agent selectors and builds an in-memory representation of the data that can be used for efficient lookups.

func BuildFromDataStore added in v0.12.0

func BuildFromDataStore(ctx context.Context, ds datastore.DataStore) (*FullEntryCache, error)

BuildFromDataStore builds a Cache using the provided datastore as the data source

func (*FullEntryCache) GetAuthorizedEntries added in v0.12.0

func (c *FullEntryCache) GetAuthorizedEntries(agentID spiffeid.ID) []*types.Entry

GetAuthorizedEntries gets all authorized registration entries for a given Agent SPIFFE ID.

type Selector added in v0.12.0

type Selector struct {
	// Type is the type of the selector.
	Type string
	// Value is the value of the selector.
	Value string
}

Selector is a key-value attribute of a node or workload.

Jump to

Keyboard shortcuts

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