Documentation
¶
Overview ¶
Package cache implements DVC's content-addressed object store (.dvc/cache/files/md5/<2>/<rest>) with atomic writes and 0o444 protection.
Index ¶
- type Cache
- func (c *Cache) AddBytes(data []byte, oid string) error
- func (c *Cache) AddFile(src, oid string) error
- func (c *Cache) Adopt(src, oid string) error
- func (c *Cache) AllObjects() ([]string, error)
- func (c *Cache) Has(oid string) bool
- func (c *Cache) LegacyPath(oid string) string
- func (c *Cache) ObjectPath(oid string) string
- func (c *Cache) Remove(oid string) error
- func (c *Cache) ResolveRead(oid string) (string, bool)
- func (c *Cache) Size(oid string) int64
- func (c *Cache) TempDir() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a content-addressed store rooted at a .dvc/cache directory.
func (*Cache) Adopt ¶
Adopt moves an already-materialized file (e.g. a verified download) into the cache under oid via an atomic rename, applying read-only protection. src must live on the same filesystem as the cache.
func (*Cache) AllObjects ¶
AllObjects returns every object id currently stored in the cache.
func (*Cache) LegacyPath ¶
LegacyPath returns the DVC 2.x cache path for an object id (.dvc/cache/<2>/<rest>, the layout used before the files/md5 split).
func (*Cache) ObjectPath ¶
ObjectPath returns the on-disk path for an object id. The id may carry a ".dir" suffix for directory manifests; the two-char prefix split matches DVC.
func (*Cache) ResolveRead ¶
ResolveRead returns the path of an existing object, preferring the modern 3.x layout and falling back to the legacy 2.x layout. This is read-only: lode always writes new objects in the modern layout.