multirepo

package
v0.0.0-...-9d6bfa7 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapping

type Mapping struct {
	Paths        []string `json:"paths"`
	Repositories []string `json:"repositories"`
	Threshold    int      `json:"threshold"`
	Terminating  bool     `json:"terminating"`
}

The following represent the map file described in TAP 4

type MultiRepoClient

type MultiRepoClient struct {
	TUFClients map[string]*updater.Updater
	Config     *MultiRepoConfig
}

MultiRepoClient represents a multi-repository TUF client

func New

func New(config *MultiRepoConfig) (*MultiRepoClient, error)

New returns a multi-repository TUF client. All repositories described in the provided map file are initialized too

func (*MultiRepoClient) DownloadTarget

func (client *MultiRepoClient) DownloadTarget(repos []string, targetFile *metadata.TargetFiles, filePath, targetBaseURL string) (string, []byte, error)

DownloadTarget downloads the target file specified by targetFile

func (*MultiRepoClient) GetTargetInfo

func (client *MultiRepoClient) GetTargetInfo(targetPath string) (*metadata.TargetFiles, []string, error)

GetTargetInfo returns metadata.TargetFiles instance with information for targetPath and a list of repositories that serve the matching target. It implements the TAP 4 search algorithm.

func (*MultiRepoClient) GetTopLevelTargets

func (client *MultiRepoClient) GetTopLevelTargets() (map[string]*metadata.TargetFiles, error)

GetTopLevelTargets returns the top-level target files for all repositories

func (*MultiRepoClient) Refresh

func (client *MultiRepoClient) Refresh() error

Refresh refreshes all repository clients

type MultiRepoConfig

type MultiRepoConfig struct {
	RepoMap           *MultiRepoMapType
	TrustedRoots      map[string][]byte
	LocalMetadataDir  string
	LocalTargetsDir   string
	DisableLocalCache bool
}

MultiRepoConfig represents the configuration for a set of trusted TUF clients

func NewConfig

func NewConfig(repoMap []byte, roots map[string][]byte) (*MultiRepoConfig, error)

NewConfig returns configuration for a multi-repo TUF client

func (*MultiRepoConfig) EnsurePathsExist

func (cfg *MultiRepoConfig) EnsurePathsExist() error

type MultiRepoMapType

type MultiRepoMapType struct {
	Repositories map[string][]string `json:"repositories"`
	Mapping      []*Mapping          `json:"mapping"`
}

Jump to

Keyboard shortcuts

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