store

package
v0.0.0-...-69a7a08 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2015 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBStore

func DBStore(db *sql.DB, imageName string) *dbStore

DBStore takes a database connection and the QDN of the image

Types

type FileCacheStore

type FileCacheStore struct {
	RemoteStore
	// contains filtered or unexported fields
}

FileCacheStore implements a super simple wrapper around RemoteStore to handle local file caching of metadata

func NewFileCacheStore

func NewFileCacheStore(remote RemoteStore, cachePath string) *FileCacheStore

func (FileCacheStore) GetMeta

func (s FileCacheStore) GetMeta(name string, size int64) (json.RawMessage, error)

type HTTPStore

type HTTPStore struct {
	// contains filtered or unexported fields
}

HTTPStore manages pulling and pushing metadata from and to a remote service over HTTP. It assumes the URL structure of the remote service maps identically to the structure of the TUF repo: <baseURL>/<metaPrefix>/(root|targets|snapshot|timestamp).json <baseURL>/<targetsPrefix>/foo.sh

If consistent snapshots are disabled, it is advised that caching is not enabled. Simple set a cachePath (and ensure it's writeable) to enable caching.

func NewHTTPStore

func NewHTTPStore(baseURL, metaPrefix, metaExtension, targetsPrefix string) (*HTTPStore, error)

func (HTTPStore) GetMeta

func (s HTTPStore) GetMeta(name string, size int64) (json.RawMessage, error)

GetMeta downloads the named meta file with the given size. A short body is acceptable because in the case of timestamp.json, the size is a cap, not an exact length.

func (HTTPStore) GetTarget

func (s HTTPStore) GetTarget(path string) (io.ReadCloser, error)

GetTarget returns a reader for the desired target or an error. N.B. The caller is responsible for closing the reader.

func (HTTPStore) SetMeta

func (s HTTPStore) SetMeta(name string, blob json.RawMessage) error

type LocalStore

type LocalStore interface {
	MetadataStore
	TargetStore
}

func MemoryStore

func MemoryStore(meta map[string]json.RawMessage, files map[string][]byte) LocalStore

type MetadataStore

type MetadataStore interface {
	GetMeta(name string, size int64) (json.RawMessage, error)
	SetMeta(name string, blob json.RawMessage) error
}

func NewFilesystemStore

func NewFilesystemStore(baseDir, metaSubDir, metaExtension, targetsSubDir string) (MetadataStore, error)

type RemoteStore

type RemoteStore interface {
	MetadataStore
	GetTarget(path string) (io.ReadCloser, error)
}

type TargetStore

type TargetStore interface {
	WalkStagedTargets(paths []string, targetsFn targetsWalkFunc) error
}

[endophage] I'm of the opinion this should go away.

Jump to

Keyboard shortcuts

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