Documentation ¶
Index ¶
- type ErrNoKey
- type ErrNotFound
- type ErrOldVersion
- type ErrTimestampKeyExists
- type MemStorage
- func (st *MemStorage) Delete(gun string) error
- func (st *MemStorage) GetCurrent(gun, role string) (data []byte, err error)
- func (st *MemStorage) GetTimestampKey(gun string) (algorithm data.KeyAlgorithm, public []byte, err error)
- func (st *MemStorage) SetTimestampKey(gun string, algorithm data.KeyAlgorithm, public []byte) error
- func (st *MemStorage) UpdateCurrent(gun string, update MetaUpdate) error
- func (st *MemStorage) UpdateMany(gun string, updates []MetaUpdate) error
- type MetaStore
- type MetaUpdate
- type MySQLStorage
- func (db *MySQLStorage) Delete(gun string) error
- func (db *MySQLStorage) GetCurrent(gun, tufRole string) (data []byte, err error)
- func (db *MySQLStorage) GetTimestampKey(gun string) (algorithm data.KeyAlgorithm, public []byte, err error)
- func (db *MySQLStorage) SetTimestampKey(gun string, algorithm data.KeyAlgorithm, public []byte) error
- func (db *MySQLStorage) UpdateCurrent(gun string, update MetaUpdate) error
- func (db *MySQLStorage) UpdateMany(gun string, updates []MetaUpdate) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrNoKey ¶
type ErrNoKey struct {
// contains filtered or unexported fields
}
ErrNoKey is returned when no timestamp key is found
type ErrNotFound ¶
type ErrNotFound struct{}
ErrNotFound is returned when TUF metadata isn't found for a specific record
type ErrOldVersion ¶
type ErrOldVersion struct{}
ErrOldVersion is returned when a newer version of TUF metadada is already available
func (ErrOldVersion) Error ¶
func (err ErrOldVersion) Error() string
ErrOldVersion is returned when a newer version of TUF metadada is already available
type ErrTimestampKeyExists ¶
type ErrTimestampKeyExists struct {
// contains filtered or unexported fields
}
ErrTimestampKeyExists is returned when a timestamp key already exists
func (ErrTimestampKeyExists) Error ¶
func (err ErrTimestampKeyExists) Error() string
ErrTimestampKeyExists is returned when a timestamp key already exists
type MemStorage ¶
type MemStorage struct {
// contains filtered or unexported fields
}
MemStorage is really just designed for dev and testing. It is very inefficient in many scenarios
func NewMemStorage ¶
func NewMemStorage() *MemStorage
NewMemStorage instantiates a memStorage instance
func (*MemStorage) Delete ¶
func (st *MemStorage) Delete(gun string) error
Delete delets all the metadata for a given GUN
func (*MemStorage) GetCurrent ¶
func (st *MemStorage) GetCurrent(gun, role string) (data []byte, err error)
GetCurrent returns the metadada for a given role, under a GUN
func (*MemStorage) GetTimestampKey ¶
func (st *MemStorage) GetTimestampKey(gun string) (algorithm data.KeyAlgorithm, public []byte, err error)
GetTimestampKey returns the public key material of the timestamp key of a given gun
func (*MemStorage) SetTimestampKey ¶
func (st *MemStorage) SetTimestampKey(gun string, algorithm data.KeyAlgorithm, public []byte) error
SetTimestampKey sets a Timestamp key under a gun
func (*MemStorage) UpdateCurrent ¶
func (st *MemStorage) UpdateCurrent(gun string, update MetaUpdate) error
UpdateCurrent updates the meta data for a specific role
func (*MemStorage) UpdateMany ¶
func (st *MemStorage) UpdateMany(gun string, updates []MetaUpdate) error
UpdateMany updates multiple TUF records
type MetaStore ¶
type MetaStore interface { UpdateCurrent(gun string, update MetaUpdate) error UpdateMany(gun string, updates []MetaUpdate) error GetCurrent(gun, tufRole string) (data []byte, err error) Delete(gun string) error GetTimestampKey(gun string) (algorithm data.KeyAlgorithm, public []byte, err error) SetTimestampKey(gun string, algorithm data.KeyAlgorithm, public []byte) error }
MetaStore holds the methods that are used for a Metadata Store
type MetaUpdate ¶
MetaUpdate packages up the fields required to update a TUF record
type MySQLStorage ¶
MySQLStorage implements a versioned store using a relational database. The database table must look like: CREATE TABLE `tuf_files` (
`id` INT AUTO_INCREMENT, `gun` VARCHAR(255) NOT NULL `role` VARCHAR(255) NOT NULL `version` INT `data` LONGBLOB PRIMARY KEY (`id`) UNIQUE INDEX (`gun`, `role`, `version`)
) DEFAULT CHARSET=utf8;
CREATE TABLE `timestamp_keys` (
`gun` VARCHAR(255), `cipher` VARCHAR(30), `public` BLOB NOT NULL,
) DEFAULT CHARSET=utf8;
func NewMySQLStorage ¶
func NewMySQLStorage(db *sql.DB) *MySQLStorage
NewMySQLStorage is a convenience method to create a MySQLStorage
func (*MySQLStorage) Delete ¶
func (db *MySQLStorage) Delete(gun string) error
Delete deletes all the records for a specific GUN
func (*MySQLStorage) GetCurrent ¶
func (db *MySQLStorage) GetCurrent(gun, tufRole string) (data []byte, err error)
GetCurrent gets a specific TUF record
func (*MySQLStorage) GetTimestampKey ¶
func (db *MySQLStorage) GetTimestampKey(gun string) (algorithm data.KeyAlgorithm, public []byte, err error)
GetTimestampKey returns the timestamps Public Key data
func (*MySQLStorage) SetTimestampKey ¶
func (db *MySQLStorage) SetTimestampKey(gun string, algorithm data.KeyAlgorithm, public []byte) error
SetTimestampKey attempts to write a TimeStamp key and returns an error if it already exists
func (*MySQLStorage) UpdateCurrent ¶
func (db *MySQLStorage) UpdateCurrent(gun string, update MetaUpdate) error
UpdateCurrent updates multiple TUF records in a single transaction. Always insert a new row. The unique constraint will ensure there is only ever
func (*MySQLStorage) UpdateMany ¶
func (db *MySQLStorage) UpdateMany(gun string, updates []MetaUpdate) error
UpdateMany atomically updates many TUF records in a single transaction