config

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 17 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetadataStore added in v2.6.0

type MetadataStore interface {
	Load(ctx context.Context, role string) ([]byte, error)
	Persist(ctx context.Context, role string, data []byte) error
}

MetadataStore optionally replaces the default filesystem metadata cache.

Implementations must preserve accepted metadata across restarts, persist each document atomically before returning, and return an error matching fs.ErrNotExist (such as os.ErrNotExist) when a role has not been stored yet. Any other error from Load is treated as a storage failure and aborts the operation rather than treating the cache as empty.

The role argument is the raw TUF role name (for example "root", "timestamp", "snapshot", "targets", or an unescaped delegated role name which may contain "/" or ".."). Implementations backed by file paths or hierarchical keys must encode or escape role rather than joining it directly as a relative path.

type UpdaterConfig

type UpdaterConfig struct {
	// MetadataStore takes precedence over the filesystem metadata cache when
	// DisableLocalCache is false. On startup, Updater loads "root" from the
	// store if present and only falls back to LocalTrustedRoot when Load("root")
	// returns fs.ErrNotExist, preserving root rotations across restarts. The
	// caller owns synchronization and store lifetime. Target storage remains
	// controlled by LocalTargetsDir.
	MetadataStore MetadataStore
	// TUF configuration
	MaxRootRotations   int64
	MaxDelegations     int
	RootMaxLength      int64
	TimestampMaxLength int64
	SnapshotMaxLength  int64
	TargetsMaxLength   int64
	// Updater configuration
	Fetcher               fetcher.Fetcher
	LocalTrustedRoot      []byte
	LocalMetadataDir      string
	LocalTargetsDir       string
	RemoteMetadataURL     string
	RemoteTargetsURL      string
	DisableLocalCache     bool
	PrefixTargetsWithHash bool
	// UnsafeLocalMode only uses the metadata as written on disk
	// if the metadata is incomplete, calling updater.Refresh will fail
	UnsafeLocalMode bool
}

func New

func New(remoteURL string, rootBytes []byte) (*UpdaterConfig, error)

New creates a new UpdaterConfig instance used by the Updater to store configuration

func (*UpdaterConfig) EnsurePathsExist

func (cfg *UpdaterConfig) EnsurePathsExist() error

func (*UpdaterConfig) SetDefaultFetcherHTTPClient added in v2.1.0

func (cfg *UpdaterConfig) SetDefaultFetcherHTTPClient(client *http.Client) error

func (*UpdaterConfig) SetDefaultFetcherRetry added in v2.1.0

func (cfg *UpdaterConfig) SetDefaultFetcherRetry(retryInterval time.Duration, retryCount uint) error

SetDefaultFetcherRetry sets the constant retry interval and count for the default fetcher

func (*UpdaterConfig) SetDefaultFetcherTransport added in v2.1.0

func (cfg *UpdaterConfig) SetDefaultFetcherTransport(rt http.RoundTripper) error

func (*UpdaterConfig) SetRetryOptions added in v2.1.0

func (cfg *UpdaterConfig) SetRetryOptions(retryOptions ...backoff.RetryOption) error

Jump to

Keyboard shortcuts

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