client

package
v5.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(u, path string) (err error)

Download a file and save it to path. The file is written first to a temporary file, and only in case of success renamed to path.

Types

type State

type State struct {
	NoCache bool // Disables cache of the metadata and files.
	Verbose bool // Prints extra messages during the operations.
	// contains filtered or unexported fields
}

State provides a way to query information and content from a swupd repository.

func NewState

func NewState(stateDir, baseContent string) (*State, error)

NewState creates a new State for the repository in baseContent, which can be either a local path or an URL. Any downloaded files will be stored under stateDir.

func (*State) GetBundleManifest

func (cs *State) GetBundleManifest(version, name, expectedHash string) (*swupd.Manifest, error)

GetBundleManifest returns the Manifest struct for a given version of a bundle. If expectedHash is not empty, it is used to verify the downloaded manifest hash.

func (*State) GetFile

func (cs *State) GetFile(elem ...string) (string, error)

GetFile returns a local path to the desired file in the swupd repository, downloading it to the local cache if needed. The elem... is relative to the baseContent.

func (*State) GetFullfile

func (cs *State) GetFullfile(version, hash string) error

GetFullfile downloads a the fullfile with hash from the given version.

func (*State) GetMoM

func (cs *State) GetMoM(version string) (*swupd.Manifest, error)

GetMoM returns the Manifest struct for the MoM of a given version.

func (*State) GetZeroPack

func (cs *State) GetZeroPack(version, name string) error

GetZeroPack downloads the zero pack for a bundle in a specific version.

func (*State) OpenFile

func (cs *State) OpenFile(elem ...string) (io.ReadCloser, error)

OpenFile opens a file from the repository. File must be closed after use. The file is currently not cached.

func (*State) Path

func (cs *State) Path(elem ...string) string

Path returns the local path to a cache file representing a file in the repository.

Jump to

Keyboard shortcuts

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