Documentation ¶
Index ¶
- Variables
- type Config
- type ErrFileAddFailed
- type Repo
- func (r *Repo) AddBlob(root string, rd io.Reader) (string, int64, error)
- func (r *Repo) AddPackage(name string, rd io.Reader, merkle string) error
- func (r *Repo) CommitUpdates(dateVersioning bool) error
- func (r *Repo) EncryptWith(path string) error
- func (r *Repo) GenKeys() error
- func (r *Repo) HasBlob(root string) bool
- func (r *Repo) Init() error
- func (r *Repo) OptionallyInitAtLocation(createIfNotExists bool) error
- func (r *Repo) PublishManifest(path string) ([]string, error)
- func (r *Repo) PublishManifests(paths []string) ([]string, error)
- type SystemTimeProvider
- type TimeProvider
Constants ¶
This section is empty.
Variables ¶
var NotCreatingNonExistentRepoError = errors.New("repo does not exist and createIfNotExist is false, so not creating one")
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config contains a common runtime configuration for repository manipulations.
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
type ErrFileAddFailed ¶
type ErrFileAddFailed string
func NewAddErr ¶
func NewAddErr(m string, e error) ErrFileAddFailed
func (ErrFileAddFailed) Error ¶
func (e ErrFileAddFailed) Error() string
type Repo ¶
func New ¶
New initializes a new Repo structure that may read/write repository data at the given path.
func (*Repo) AddBlob ¶
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 ¶
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 ¶
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 (*Repo) GenKeys ¶
GenKeys will generate a full suite of the necessary keys for signing a repository.
func (*Repo) HasBlob ¶
HasBlob returns true if the given merkleroot is already in the repository blob store.
func (*Repo) Init ¶
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 ¶
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 ¶
PublishManifest publishes the package and blobs identified in the package output manifest at the given path, 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.