File: interfaces.go

package info (click to toggle)
docker.io 28.5.2%2Bdfsg3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 68,176 kB
  • sloc: sh: 5,867; makefile: 863; ansic: 184; python: 162; asm: 159
file content (39 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package storage

import (
	"github.com/theupdateframework/notary/tuf/data"
)

// NoSizeLimit is represented as -1 for arguments to GetMeta
const NoSizeLimit int64 = -1

// MetadataStore must be implemented by anything that intends to interact
// with a store of TUF files
type MetadataStore interface {
	GetSized(name string, size int64) ([]byte, error)
	Set(name string, blob []byte) error
	SetMulti(map[string][]byte) error
	RemoveAll() error
	Remove(name string) error
	Location() string
}

// PublicKeyStore must be implemented by a key service
type PublicKeyStore interface {
	GetKey(role data.RoleName) ([]byte, error)
	RotateKey(role data.RoleName) ([]byte, error)
}

// RemoteStore is similar to LocalStore with the added expectation that it should
// provide a way to download targets once located
type RemoteStore interface {
	MetadataStore
	PublicKeyStore
}

// Bootstrapper is a thing that can set itself up
type Bootstrapper interface {
	// Bootstrap instructs a configured Bootstrapper to perform
	// its setup operations.
	Bootstrap() error
}