Documentation ¶
Overview ¶
Package cas implements a content-addressable-store on disk. It leverages the `diskv` package to store items in a simple key-value blob store: https://github.com/peterbourgon/diskv
Index ¶
- func WriteACIInfo(tx *sql.Tx, aciinfo *ACIInfo) error
- func WriteRemote(tx *sql.Tx, remote *Remote) error
- type ACIInfo
- type DB
- type Remote
- type Store
- func (ds Store) Dump(hex bool)
- func (ds Store) GetACI(name types.ACName, labels types.Labels) (string, error)
- func (ds Store) GetImageManifest(key string) (*schema.ImageManifest, error)
- func (ds Store) GetRemote(aciURL string) (*Remote, bool, error)
- func (ds Store) HashToKey(h hash.Hash) string
- func (ds Store) ReadStream(key string) (io.ReadCloser, error)
- func (ds Store) ResolveKey(key string) (string, error)
- func (ds Store) WriteACI(r io.Reader, latest bool) (string, error)
- func (ds Store) WriteRemote(remote *Remote) error
- func (ds Store) WriteStream(key string, r io.Reader) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteACIInfo ¶ added in v0.4.0
WriteACIInfo adds or updates the provided aciinfo.
Types ¶
type ACIInfo ¶ added in v0.4.0
type ACIInfo struct { // BlobKey is the key in the blob/imageManifest store of the related // ACI file and is the db primary key. BlobKey string // AppName is the app name provided by the ACI. AppName string // ImportTime is the time this ACI was imported in the store. ImportTime time.Time // Latest defines if the ACI was imported using the latest pattern (no // version label was provided on ACI discovery) Latest bool }
ACIInfo is used to store information about an ACI.
func GetACIInfosWithAppName ¶ added in v0.4.0
GetAciInfosWithAppName returns all the ACIInfos for a given appname. found will be false if no aciinfo exists.
func GetACIInfosWithKeyPrefix ¶ added in v0.4.0
GetAciInfosWithKeyPrefix returns all the ACIInfos with a blobkey starting with the given prefix.
type DB ¶ added in v0.4.0
type DB struct {
// contains filtered or unexported fields
}
type Remote ¶
type Remote struct { ACIURL string SigURL string ETag string // The key in the blob store under which the ACI has been saved. BlobKey string }
func GetRemote ¶ added in v0.4.0
GetRemote tries to retrieve a remote with the given aciURL. found will be false if remote doesn't exist.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store encapsulates a content-addressable-storage for storing ACIs on disk.
func (Store) GetACI ¶ added in v0.4.2
GetACI retrieves the ACI that best matches the provided app name and labels. The returned value is the blob store key of the retrieved ACI. If there are multiple matching ACIs choose the latest one (defined as the last one imported in the store). If no version label is requested, ACIs marked as latest in the ACIInfo are preferred.
func (Store) GetImageManifest ¶ added in v0.4.0
func (ds Store) GetImageManifest(key string) (*schema.ImageManifest, error)
Get the ImageManifest with the specified key.
func (Store) GetRemote ¶ added in v0.4.0
GetRemote tries to retrieve a remote with the given ACIURL. found will be false if remote doesn't exist.
func (Store) HashToKey ¶ added in v0.4.0
HashToKey takes a hash.Hash (which currently _MUST_ represent a full SHA512), calculates its sum, and returns a string which should be used as the key to store the data matching the hash.
func (Store) ReadStream ¶
func (ds Store) ReadStream(key string) (io.ReadCloser, error)
func (Store) ResolveKey ¶ added in v0.2.0
ResolveKey resolves a partial key (of format `sha512-0c45e8c0ab2`) to a full key by considering the key a prefix and using the store for resolution. If the key is longer than the full key length, it is first truncated.
func (Store) WriteACI ¶
WriteACI takes an ACI encapsulated in an io.Reader, decompresses it if necessary, and then stores it in the store under a key based on the image ID (i.e. the hash of the uncompressed ACI) latest defines if the aci has to be marked as the latest. For example an ACI discovered without asking for a specific version (latest pattern).
func (Store) WriteRemote ¶ added in v0.4.0
WriteRemote adds or updates the provided Remote.