repo

package
v0.0.0-...-2208570 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: BSD-2-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotCreatingNonExistentRepoError = errors.New("repo does not exist and createIfNotExist is false, so not creating one")

Functions

This section is empty.

Types

type Config

type Config struct {
	RepoDir       string
	TimeVersioned bool
}

Config contains a common runtime configuration for repository manipulations.

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

func (*Config) Vars

func (c *Config) Vars(fs *flag.FlagSet)

type ErrFileAddFailed

type ErrFileAddFailed string

func NewAddErr

func NewAddErr(m string, e error) ErrFileAddFailed

func (ErrFileAddFailed) Error

func (e ErrFileAddFailed) Error() string

type Repo

type Repo struct {
	*tuf.Repo
	// contains filtered or unexported fields
}

func New

func New(path string) (*Repo, error)

New initializes a new Repo structure that may read/write repository data at the given path.

func (*Repo) AddBlob

func (r *Repo) AddBlob(root string, rd io.Reader) (string, int64, error)

AddBlob writes the content of the given reader to the blob identified by the given merkleroot. If merkleroot is empty string, a merkleroot is computed. Addblob always returns the plaintext size of the blob that is added, even if blob encryption is used.

func (*Repo) AddPackage

func (r *Repo) AddPackage(name string, rd io.Reader, merkle string) error

AddPackage adds a package with the given name with the content from the given reader. The package blob is also added. If merkle is non-empty, it is used, otherwise the package merkleroot is computed on the fly.

func (*Repo) CommitUpdates

func (r *Repo) CommitUpdates(dateVersioning bool) error

CommitUpdates finalizes the changes to the update repository that have been staged by calling AddPackageFile. Setting dateVersioning to true will set the version of the targets, snapshot, and timestamp metadata files based on an offset in seconds from epoch (1970-01-01 00:00:00 UTC).

func (*Repo) EncryptWith

func (r *Repo) EncryptWith(path string) error

func (*Repo) GenKeys

func (r *Repo) GenKeys() error

GenKeys will generate a full suite of the necessary keys for signing a repository.

func (*Repo) HasBlob

func (r *Repo) HasBlob(root string) bool

HasBlob returns true if the given merkleroot is already in the repository blob store.

func (*Repo) Init

func (r *Repo) Init() error

Init initializes a repository, preparing it for publishing. If a repository already exists, either os.ErrExist, or a TUF error are returned. If a repository does not exist at the given location, a repo will be created there.

func (*Repo) OptionallyInitAtLocation

func (r *Repo) OptionallyInitAtLocation(createIfNotExists bool) error

OptionallyInitAtLocation initializes a new repository, preparing it for publishing, if a repository does not already exist at its location and createIfNotExists is true. If a repository already exists, either os.ErrExist, or a TUF error are returned.

func (*Repo) PublishManifest

func (r *Repo) PublishManifest(path string) ([]string, error)

PublishManifest publishes the package and blobs identified in the package output manifest at the given path, returning all input files involved, or an error.

func (*Repo) PublishManifests

func (r *Repo) PublishManifests(paths []string) ([]string, error)

PublishManifests publishes the packages and blobs identified in the package output manifests at the given paths, returning all input files involved, or an error.

type SystemTimeProvider

type SystemTimeProvider struct{}

SystemProvider uses the time pkg to get Unix timestamp.

func (*SystemTimeProvider) UnixTimestamp

func (*SystemTimeProvider) UnixTimestamp() int

type TimeProvider

type TimeProvider interface {
	// UnixTimestamp returns the Unix timestamp.
	UnixTimestamp() int
}

TimeProvider provides the service to get Unix timestamp.

Jump to

Keyboard shortcuts

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