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
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 FetchRegistrationEntriesCache ¶
type FetchRegistrationEntriesCache struct {
Cache *lru.Cache
TimeNow func() time.Time
// contains filtered or unexported fields
}
FetchRegistrationEntriesCache is a wrapper around LRU cache with expiry, used for caching registration entries of a agent
func NewFetchX509SVIDCache ¶
func NewFetchX509SVIDCache(cacheSize int) (*FetchRegistrationEntriesCache, error)
func (*FetchRegistrationEntriesCache) AddWithExpire ¶
func (c *FetchRegistrationEntriesCache) AddWithExpire(key string, value []*common.RegistrationEntry, expire time.Duration)
func (*FetchRegistrationEntriesCache) Get ¶
func (c *FetchRegistrationEntriesCache) Get(key string) ([]*common.RegistrationEntry, bool)
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
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 RegistrationEntriesCache ¶
type RegistrationEntriesCache interface {
Get(key string) ([]*common.RegistrationEntry, bool)
AddWithExpire(key string, value []*common.RegistrationEntry, expire time.Duration)
}