2016-09-21 16:18:22 -07:00
|
|
|
package storage
|
2015-07-23 03:04:01 -07:00
|
|
|
|
2016-05-11 15:25:05 -07:00
|
|
|
// NoSizeLimit is represented as -1 for arguments to GetMeta
|
|
|
|
const NoSizeLimit int64 = -1
|
|
|
|
|
2015-10-30 17:31:02 -07:00
|
|
|
// MetadataStore must be implemented by anything that intends to interact
|
|
|
|
// with a store of TUF files
|
2015-07-23 03:04:01 -07:00
|
|
|
type MetadataStore interface {
|
2016-09-21 16:18:22 -07:00
|
|
|
GetSized(name string, size int64) ([]byte, error)
|
|
|
|
Set(name string, blob []byte) error
|
|
|
|
SetMulti(map[string][]byte) error
|
2016-01-26 14:21:07 -08:00
|
|
|
RemoveAll() error
|
2016-09-21 16:18:22 -07:00
|
|
|
Remove(name string) error
|
2015-07-23 03:04:01 -07:00
|
|
|
}
|
|
|
|
|
2015-10-30 17:31:02 -07:00
|
|
|
// PublicKeyStore must be implemented by a key service
|
2015-07-23 03:04:01 -07:00
|
|
|
type PublicKeyStore interface {
|
|
|
|
GetKey(role string) ([]byte, error)
|
2016-09-21 16:18:22 -07:00
|
|
|
RotateKey(role string) ([]byte, error)
|
2015-07-23 03:04:01 -07:00
|
|
|
}
|
|
|
|
|
2015-10-30 17:31:02 -07:00
|
|
|
// RemoteStore is similar to LocalStore with the added expectation that it should
|
|
|
|
// provide a way to download targets once located
|
2015-07-23 03:04:01 -07:00
|
|
|
type RemoteStore interface {
|
|
|
|
MetadataStore
|
|
|
|
PublicKeyStore
|
|
|
|
}
|
2016-09-21 16:18:22 -07:00
|
|
|
|
|
|
|
// Bootstrapper is a thing that can set itself up
|
|
|
|
type Bootstrapper interface {
|
|
|
|
// Bootstrap instructs a configured Bootstrapper to perform
|
|
|
|
// its setup operations.
|
|
|
|
Bootstrap() error
|
|
|
|
}
|