Documentation ¶
Index ¶
- Constants
- Variables
- type Blob
- type BlobData
- type DB
- type Data
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteBlob(digest string) error
- func (s *Store) DeleteBlobData(digest, dataType string) error
- func (s *Store) DeleteData(key, dataType string) error
- func (s *Store) GC() error
- func (s *Store) GetBlobData(digest, dataType string) (*BlobData, error)
- func (s *Store) GetBlobInfo(digest string) (*Blob, error)
- func (s *Store) GetData(key, dataType string) (*Data, error)
- func (s *Store) ListAllDataKeys(dataType string) ([]string, error)
- func (s *Store) ListBlobs(mediaType string) ([]string, error)
- func (s *Store) ReadBlob(digest string) (io.ReadCloser, error)
- func (s *Store) ResolveDigest(inDigest string) (string, error)
- func (s *Store) SetBlobData(digest string, data []byte, dataType string) error
- func (s *Store) SetData(key string, value []byte, dataType, digest string) error
- func (s *Store) TmpDir() (string, error)
- func (s *Store) TmpFile() (*os.File, error)
- func (s *Store) WriteBlob(r io.ReadSeeker, mediaType string) (string, error)
Constants ¶
const (
DbFilename = "ql.db"
)
Variables ¶
var ( ErrDigestNotFound = errors.New("no digest found") ErrMultipleDigests = errors.New("found multiple digests") // ErrRemovingBlobContents defines an error removing non transactional (diskv) blob contents // When this happen there's the possibility that the store is left in an // unclean state (for example with some stale files). This will be fixed by store GC ErrRemovingBlobContents = errors.New("failed to remove blob disk contents") )
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store encapsulates a content-addressable-storage for storing blobs on disk. It's an indexed CAS with the ability to augment a blob with additional data and a key value store (with optional references to a blob)
func (*Store) DeleteBlob ¶
DeleteBlob removes a blob. It firstly removes the blob infos from the db, then it tries to remove the non transactional data. If some error occurs removing some non transactional data a ErrRemovingBlobContents is returned. The user may ignore this error since a followin GC will try to remove it and the blob won't be available with the other functions.
func (*Store) DeleteBlobData ¶
DelBlobData removes additional data of dataType from a blob
func (*Store) DeleteData ¶
DeleteData removes additional data with the specified key and dataType
func (*Store) GC ¶
GC garbage collects stale blobs contents (blobs not appering in the db) (this can happen if they aren't removed for whatever reason) and remove unused keylocks
func (*Store) GetBlobData ¶
GetBlobData gets additional data of dataType from a blob
func (*Store) GetBlobInfo ¶
GetBlobInfo return blob info for the provided blob digest If the blob doesn't exists the return value will be nil
func (*Store) ListAllDataKeys ¶
ListData returns a list of all data for the given dataType
func (*Store) ReadBlob ¶
func (s *Store) ReadBlob(digest string) (io.ReadCloser, error)
ReadBlob return an io.ReadCloser for the requested digest
func (*Store) ResolveDigest ¶
ResolveDigest resolves a partial digest (of format `sha256-0c45e8c0ab2`) to a full digest by considering the digest prefix and using the store for resolution.
func (*Store) SetBlobData ¶
SetBlobData set additional data of dataType to a blob It'll be removed when the blob is removed
func (*Store) SetData ¶
SetData adds additional data of dataType. The data has an unique key to easily list and search by key If digest is not nil it can reference a blob digest and it'll be removed when the blob is removed. This can be useful to add custom data to the store. For example: * oci references where key is the ref name and data is an oci descriptor * remote caching information for an appc ACI store where key is the download URL, data contains additional data (like http caching information) and if references a digest to an ACI blob. TODO(sgotti) add a version field and a ErrConcurrentUpdate as a facility for clients to do optimistic locking? it should be useful to handle data migration without chaning the dataType
func (*Store) TmpDir ¶
TmpDir creates and returns dir local to the same filesystem as the Store, or any error encountered
func (*Store) TmpFile ¶
TmpFile returns an *os.File local to the same filesystem as the Store, or any error encountered