Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWrongState = errors.New("wrong state of cache writer")
ErrWrongState is returned when the entry writer is in the wrong state, for example the user attempts to discard an already committed writer.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { IsCached(context.Context, digest.Digest) (bool, error) Open(context.Context, digest.Digest) (io.ReadCloser, int64, error) Create(context.Context) (EntryWriter, error) ReadMeta(context.Context, digest.Digest, string) ([]byte, error) }
A Cache stores blobs and makes them available using their digest.
func DefaultCache ¶
DefaultCache returns a Cache configured to use the local file system in the user preferred location.
On Linux, this is usually $HOME/.cache/vinci/v1/.
func InDirectory ¶
func NewMemCache ¶
func NewMemCache() Cache
type EntryWriter ¶
type EntryWriter interface { io.Writer io.Closer Digest() digest.Digest Size() int64 Commit() error Discard() error SetMeta(context.Context, string, []byte) error }
EntryWriter is used to control the actual submission of a blob to a cache. The following protocol is to be used when an EntryWriter is returned:
* Write() to the io.Writer part. * Close() the file via io.Closer. After closing, the digest can be retrieved via Digest(), the written size via Size().
If the entry is to be committed into the store, use Commit(), otherwise, use Discard().
For cases where the final call to Commit() or Discard() is missing, the cache SHOULD offer a way to discard accrued garbage.