Documentation
¶
Index ¶
- Variables
- func LoadDefaultRepositoryTypes() error
- func RegisterCollectorType(moniker string, factory RepositoryFactory) error
- func RepositoryFromString(init string) (attestation.Repository, error)
- func UnregisterCollectorType(moniker string)
- type Agent
- func (agent *Agent) AddRepository(repos ...attestation.Repository) error
- func (agent *Agent) AddRepositoryFromString(init string) error
- func (agent *Agent) Fetch(ctx context.Context, optFn ...FetchOptionsFunc) ([]attestation.Envelope, error)
- func (agent *Agent) FetchAttestationsByPredicateType(ctx context.Context, pt []attestation.PredicateType, optFn ...FetchOptionsFunc) ([]attestation.Envelope, error)
- func (agent *Agent) FetchAttestationsBySubject(ctx context.Context, subjects []attestation.Subject, optFn ...FetchOptionsFunc) ([]attestation.Envelope, error)
- type Cache
- type FetchOptionsFunc
- type InitFunction
- type MemoryCache
- func (memcache *MemoryCache) GetAttestationsByPredicateType(ctx context.Context, pt []attestation.PredicateType) (*[]attestation.Envelope, error)
- func (memcache *MemoryCache) GetAttestationsBySubject(ctx context.Context, subjects []attestation.Subject) (*[]attestation.Envelope, error)
- func (memcache *MemoryCache) StoreAttestationsByPredicateType(ctx context.Context, pt []attestation.PredicateType, ...) error
- func (memcache *MemoryCache) StoreAttestationsBySubject(ctx context.Context, subjects []attestation.Subject, ...) error
- type Options
- type RepositoryFactory
- type StoreOptionsFunc
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoFetcherConfigured = errors.New("no repository with fetch capabilities configured") ErrNoStorerConfigured = errors.New("no repository with store capabilities configured") )
var (
ErrTypeAlreadyRegistered = errors.New("collector type already registered")
)
Functions ¶
func LoadDefaultRepositoryTypes ¶
func LoadDefaultRepositoryTypes() error
LoadDefaultRepositoryTypes loads the default repository types into the in-memory list to get them ready for instantiation.
func RegisterCollectorType ¶
func RegisterCollectorType(moniker string, factory RepositoryFactory) error
RegisterCollectorType registers a new type of collector
func RepositoryFromString ¶
func RepositoryFromString(init string) (attestation.Repository, error)
func UnregisterCollectorType ¶
func UnregisterCollectorType(moniker string)
RegisterCollectorType registers a new type of collector
Types ¶
type Agent ¶
type Agent struct {
Options Options
Cache Cache
Repositories []attestation.Repository
}
Agent is the attestations collector agent. The agent registers a number of repositories and can look for attestations in them.
The agent exposes the attestation.Fetcher and attestation.Storer methods, when called, the collector agent invokes the corresponding method in all configured repository drivers.
func New ¶
func New(funcs ...InitFunction) (*Agent, error)
New returns a new agent with the default options
func NewWithOptions ¶
NewWithOptions returns a new agent configured with a specific options set
func (*Agent) AddRepository ¶
func (agent *Agent) AddRepository(repos ...attestation.Repository) error
AddRepsitory adds a new repository to collect attestations
func (*Agent) AddRepositoryFromString ¶
func (*Agent) Fetch ¶
func (agent *Agent) Fetch(ctx context.Context, optFn ...FetchOptionsFunc) ([]attestation.Envelope, error)
Fetch is a general attestation fetcher. It is intended to return attestations in the preferred order of the driver without any optimization whatsoever.
func (*Agent) FetchAttestationsByPredicateType ¶
func (agent *Agent) FetchAttestationsByPredicateType(ctx context.Context, pt []attestation.PredicateType, optFn ...FetchOptionsFunc) ([]attestation.Envelope, error)
FetchAttestationsByPredicateType requests all attestations of a particular type from the configured repositories.
func (*Agent) FetchAttestationsBySubject ¶
func (agent *Agent) FetchAttestationsBySubject(ctx context.Context, subjects []attestation.Subject, optFn ...FetchOptionsFunc) ([]attestation.Envelope, error)
FetchAttestationsBySubject requests all attestations about a list of subjects from the configured repositories. It is understood that the repos will return all attestations available about the specified subjects.
type Cache ¶
type Cache interface {
StoreAttestationsByPredicateType(context.Context, []attestation.PredicateType, *[]attestation.Envelope) error
GetAttestationsByPredicateType(context.Context, []attestation.PredicateType) (*[]attestation.Envelope, error)
StoreAttestationsBySubject(context.Context, []attestation.Subject, *[]attestation.Envelope) error
GetAttestationsBySubject(context.Context, []attestation.Subject) (*[]attestation.Envelope, error)
}
type FetchOptionsFunc ¶
type FetchOptionsFunc func(*attestation.FetchOptions)
FetchOptionsFunc are functions to define options when fetching
func WithLimit ¶ added in v0.1.2
func WithLimit(n int) FetchOptionsFunc
WithLimit sets the maximum number of attestations to be returned by the agent
func WithQuery ¶
func WithQuery(q *attestation.Query) FetchOptionsFunc
WithQuery passes a query to the options set
type InitFunction ¶
func WithParallelFetches ¶
func WithParallelFetches(threads int) InitFunction
func WithParallelStores ¶
func WithParallelStores(threads int) InitFunction
func WithRepository ¶
func WithRepository(repo attestation.Repository) InitFunction
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
func NewMemoryCache ¶
func NewMemoryCache() *MemoryCache
func (*MemoryCache) GetAttestationsByPredicateType ¶
func (memcache *MemoryCache) GetAttestationsByPredicateType(ctx context.Context, pt []attestation.PredicateType) (*[]attestation.Envelope, error)
func (*MemoryCache) GetAttestationsBySubject ¶
func (memcache *MemoryCache) GetAttestationsBySubject(ctx context.Context, subjects []attestation.Subject) (*[]attestation.Envelope, error)
func (*MemoryCache) StoreAttestationsByPredicateType ¶
func (memcache *MemoryCache) StoreAttestationsByPredicateType(ctx context.Context, pt []attestation.PredicateType, atts *[]attestation.Envelope) error
func (*MemoryCache) StoreAttestationsBySubject ¶
func (memcache *MemoryCache) StoreAttestationsBySubject(ctx context.Context, subjects []attestation.Subject, atts *[]attestation.Envelope) error
type Options ¶
type Options struct {
UserAgentString string
// FailIfNoFetchers Return an error when fetching if no repos are configured (instead of just nil)
FailIfNoFetchers bool
// Use cache controls if the agent uses the attestation cache
UseCache bool
ParallelFetches int
ParallelStores int
Fetch attestation.FetchOptions
Store attestation.StoreOptions
}
Options groups the configuration knob for the collector agent
type RepositoryFactory ¶
type RepositoryFactory func(string) (attestation.Repository, error)
type StoreOptionsFunc ¶
type StoreOptionsFunc func(*attestation.StoreOptions)
StoreOptionsFunc are functions to define options when fetching
Directories
¶
| Path | Synopsis |
|---|---|
|
bare
Package bare implenta a parser to make non-signed attestations compatible with the ampel policy engine.
|
Package bare implenta a parser to make non-signed attestations compatible with the ampel policy engine. |
|
bundle
Packager bundle provides functionality to work with the sigstore budle format
|
Packager bundle provides functionality to work with the sigstore budle format |
|
generic
Package generic is a generic predicate that can be used as a wrapper for most predicate payloads
|
Package generic is a generic predicate that can be used as a wrapper for most predicate payloads |
|
repository
|
|
|
filesystem
Package filesystem implements an attestation collector from a fs.FS
|
Package filesystem implements an attestation collector from a fs.FS |
|
git
Package git implements an attestations collector that works on a git repository.
|
Package git implements an attestations collector that works on a git repository. |
|
github
Package github implements a collector that reads from the GitHub attestations store.
|
Package github implements a collector that reads from the GitHub attestations store. |
|
http
Package http implements an attestations collector that reads data from an https endpoint.
|
Package http implements an attestations collector that reads data from an https endpoint. |
|
jsonl
Package jsonl implements an attestations collector that reads from files using the JSON Lines (jsonl) format.
|
Package jsonl implements an attestations collector that reads from files using the JSON Lines (jsonl) format. |
|
note
Package note implements an attestation fetcher that can read from git commit notes.
|
Package note implements an attestation fetcher that can read from git commit notes. |
|
ossrebuild
Package http implements an attestations collector that reads data from an https endpoint.
|
Package http implements an attestations collector that reads data from an https endpoint. |
|
intoto
Package intoto implements a parser and a statement variant for attestations in the in-toto format.
|
Package intoto implements a parser and a statement variant for attestations in the in-toto format. |