Documentation
¶
Overview ¶
Package note implements an attestation fetcher that can read from git commit notes.
Index ¶
- Variables
- func DynamicRepoURL(url string) optFn
- func WithHttpAuth(username, password string) optFn
- func WithInit(init string) optFn
- func WithLocator(locator string) optFn
- func WithPush(push bool) optFn
- type Collector
- func (c *Collector) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
- func (c *Collector) FetchByPredicateType(ctx context.Context, opts attestation.FetchOptions, ...) ([]attestation.Envelope, error)
- func (c *Collector) FetchBySubject(ctx context.Context, opts attestation.FetchOptions, subj []attestation.Subject) ([]attestation.Envelope, error)
- func (c *Collector) Store(ctx context.Context, opts attestation.StoreOptions, ...) error
- type Dynamic
- func (c *Dynamic) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
- func (c *Dynamic) FetchBySubject(ctx context.Context, opts attestation.FetchOptions, subj []attestation.Subject) ([]attestation.Envelope, error)
- func (c *Dynamic) Store(ctx context.Context, opts attestation.StoreOptions, ...) error
- type Options
Constants ¶
This section is empty.
Variables ¶
var Build = func(istr string) (attestation.Repository, error) { return New(WithLocator(istr)) }
Implement the factory function
var BuildDynamic = func(istr string) (attestation.Repository, error) { return NewDynamic(DynamicRepoURL(istr)) }
Implement the factory function
var TypeMoniker = "note"
var (
TypeMonikerDynamic = "dnote"
)
Functions ¶
func DynamicRepoURL ¶ added in v0.3.0
func DynamicRepoURL(url string) optFn
func WithHttpAuth ¶ added in v0.2.7
func WithHttpAuth(username, password string) optFn
func WithLocator ¶
func WithLocator(locator string) optFn
Types ¶
type Collector ¶
type Collector struct {
Options Options
}
func (*Collector) Fetch ¶
func (c *Collector) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
Fetch queries the repository and retrieves any attestations matching the query
func (*Collector) FetchByPredicateType ¶
func (c *Collector) FetchByPredicateType(ctx context.Context, opts attestation.FetchOptions, pts []attestation.PredicateType) ([]attestation.Envelope, error)
func (*Collector) FetchBySubject ¶
func (c *Collector) FetchBySubject(ctx context.Context, opts attestation.FetchOptions, subj []attestation.Subject) ([]attestation.Envelope, error)
FetchBySubject calls the attestation reader with a filter preconfigured with subject hashes.
func (*Collector) Store ¶ added in v0.2.7
func (c *Collector) Store(ctx context.Context, opts attestation.StoreOptions, envelopes []attestation.Envelope) error
Store implements the attestation.Storer interface
type Dynamic ¶ added in v0.3.0
type Dynamic struct {
Options Options
}
Dynamic is a collector that works with any commit by dynamically creating a a fixed notes collector when trying to read a sha1 subject. Instead of beign preconfigured to read from a specific commit, dynamic creates a collector on the fly on every read request.
func NewDynamic ¶ added in v0.3.0
func (*Dynamic) Fetch ¶ added in v0.3.0
func (c *Dynamic) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
Fetch is a noop only to implement the main interface
func (*Dynamic) FetchBySubject ¶ added in v0.3.0
func (c *Dynamic) FetchBySubject(ctx context.Context, opts attestation.FetchOptions, subj []attestation.Subject) ([]attestation.Envelope, error)
FetchBySubject calls the attestation reader with a filter preconfigured with subject hashes.
func (*Dynamic) Store ¶ added in v0.3.0
func (c *Dynamic) Store(ctx context.Context, opts attestation.StoreOptions, envelopes []attestation.Envelope) error
Store implements the attestation.Storer interface. It inspects all envelopes to extract sha1/gitCommit subjects, groups them by commit, and stores each group using a dedicated notes collector. If any envelope lacks a sha1 or gitCommit subject, an error is returned before any writes occur.
type Options ¶
type Options struct {
Locator string
// Push determines whether to push notes to remote after storing.
// If nil, defaults to true for remote repos, false for local file:// repos.
Push *bool
// Username and password to use when git connects via HTTP
HttpUsername, HttpPassword string
// DynamicRepoURL holds the repostory URL for the dynamic notes collector
DynamicRepoURL string
}