note

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package note implements an attestation fetcher that can read from git commit notes.

Index

Constants

This section is empty.

Variables

View Source
var Build = func(istr string) (attestation.Repository, error) {
	return New(WithLocator(istr))
}

Implement the factory function

View Source
var BuildDynamic = func(istr string) (attestation.Repository, error) {
	return NewDynamic(DynamicRepoURL(istr))
}

Implement the factory function

View Source
var TypeMoniker = "note"
View Source
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 WithInit added in v0.2.7

func WithInit(init string) optFn

func WithLocator

func WithLocator(locator string) optFn

func WithPush added in v0.2.7

func WithPush(push bool) optFn

Types

type Collector

type Collector struct {
	Options Options
}

func New

func New(funcs ...optFn) (*Collector, error)

func (*Collector) Fetch

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 NewDynamic(funcs ...optFn) (*Dynamic, error)

func (*Dynamic) Fetch added in v0.3.0

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
}

func (*Options) Validate

func (o *Options) Validate() error

Jump to

Keyboard shortcuts

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