Documentation
¶
Overview ¶
Package store keeps snapshot blobs content-addressed under <state>/blobs/sha256/<digest>. Snapshot and instance directories hold hard links into it, so a part shared by two snapshots exists once on disk and pulling a snapshot that shares parts with one already present copies nothing. GC removes the blobs no snapshot refers to.
Index ¶
- func CopyFile(ctx context.Context, src, dst string) (string, int64, error)
- func HashFile(ctx context.Context, name string) (string, int64, error)
- type Store
- func (s Store) Add(ctx context.Context, name string) (string, int64, error)
- func (s Store) AddHashed(ctx context.Context, name, digest string) error
- func (s Store) BlobPath(digest string) (string, error)
- func (s Store) Blobs() string
- func (s Store) GC(ctx context.Context, keep map[string]bool) (int64, error)
- func (s Store) Has(digest string) bool
- func (s Store) Ingest(ctx context.Context, r io.Reader, digest string, size int64) error
- func (s Store) Link(ctx context.Context, digest, dst string) error
- func (s Store) List() ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store struct {
Root string
}
Store is a blob directory.
func (Store) Add ¶
Add hashes the file and makes it a blob: a hard link when the file is on the store's filesystem, a copy otherwise. The blob, and through the link the file itself, becomes read-only.
func (Store) AddHashed ¶
AddHashed records a file whose digest the caller already computed while writing it, without reading it again.
func (Store) GC ¶
GC removes blobs not in keep and returns the bytes freed. A blob still linked from a snapshot directory keeps its data there; only the store's name goes.
func (Store) Ingest ¶
Ingest streams r into the store as digest, checking the bytes hash to it and number size. A blob already present is not read again.