store

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

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

Go to latest
Published: Sep 4, 2015 License: BSD-3-Clause Imports: 18 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

func NewFilesystemStore

func NewFilesystemStore(baseDir, metaSubDir, metaExtension, targetsSubDir string) (*filesystemStore, error)

func NewMemoryStore

func NewMemoryStore(meta map[string][]byte, files map[string][]byte) *memoryStore

Types

type ErrMaliciousServer

type ErrMaliciousServer struct{}

func (ErrMaliciousServer) Error

func (err ErrMaliciousServer) Error() string

type ErrMetaNotFound

type ErrMetaNotFound struct{}

func (ErrMetaNotFound) Error

func (err ErrMetaNotFound) Error() string

type ErrServerUnavailable

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

func (ErrServerUnavailable) Error

func (err ErrServerUnavailable) Error() string

type ErrShortRead

type ErrShortRead struct{}

func (ErrShortRead) Error

func (err ErrShortRead) Error() string

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, keyExtension string, roundTrip http.RoundTripper) (*HTTPStore, error)

func (HTTPStore) GetKey

func (s HTTPStore) GetKey(role string) ([]byte, error)

func (HTTPStore) GetMeta

func (s HTTPStore) GetMeta(name string, size int64) ([]byte, 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 []byte) error

func (HTTPStore) SetMultiMeta

func (s HTTPStore) SetMultiMeta(metas map[string][]byte) error

type LocalStore

type LocalStore interface {
	MetadataStore
	TargetStore
}

type MetadataStore

type MetadataStore interface {
	GetMeta(name string, size int64) ([]byte, error)
	SetMeta(name string, blob []byte) error
	SetMultiMeta(map[string][]byte) error
}

type PublicKeyStore

type PublicKeyStore interface {
	GetKey(role string) ([]byte, error)
}

type RemoteStore

type RemoteStore interface {
	MetadataStore
	PublicKeyStore
	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