Documentation ¶
Overview ¶
Package cache provides the blob cache.
File name convention:
blobs/sha256/*.tmp: tmp files
blobs/sha256/<SHA256>: verified blobs
urls/sha256/<SHA256> : URL of the blob (optional)
digests/by-url-sha256/<SHA256-OF-URL> : digest of the blob (optional)
Index ¶
- Constants
- type Cache
- func (c *Cache) BlobAbsPath(sha256sum string) (string, error)
- func (c *Cache) BlobRelPath(sha256sum string) (string, error)
- func (c *Cache) Cached(sha256sum string) (bool, error)
- func (c *Cache) Dir() string
- func (c *Cache) Ensure(ctx context.Context, u *url.URL, sha256sum string) error
- func (c *Cache) Export(dir string) (map[string]string, error)
- func (c *Cache) Import(dirOrFiles ...string) (map[string]string, error)
- func (c *Cache) ImportWithReader(r io.Reader) (sha256sum string, err error)
- func (c *Cache) ImportWithURL(u *url.URL) (sha256sum string, err error)
- func (c *Cache) OriginURLBySHA256(sha256sum string) (*url.URL, error)
- func (c *Cache) ReverseURLFileAbsPath(u *url.URL) (string, error)
- func (c *Cache) ReverseURLFileRelPath(u *url.URL) (string, error)
- func (c *Cache) SHA256ByOriginURL(u *url.URL) (string, error)
- func (c *Cache) URLFileAbsPath(sha256sum string) (string, error)
- func (c *Cache) URLFileRelPath(sha256sum string) (string, error)
Constants ¶
const ( BlobsSHA256RelPath = "blobs/sha256" URLsSHA256RelPath = "urls/sha256" ReverseURLRelPath = "digests/by-url-sha256" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) BlobRelPath ¶
BlobRelPath returns a clean relative path like "blobs/sha256/<SHA256>". The caller should append this path to c.Dir(). The returned path may not exist. If it exists, its digest must have been already verified.
func (*Cache) Import ¶
Import imports local directories or files, and returns map[basename]sha256sum .
func (*Cache) ImportWithReader ¶
ImportWithReader imports from the reader. Does not create the URL file.
func (*Cache) ImportWithURL ¶
func (*Cache) OriginURLBySHA256 ¶
OriginURLBySHA256 returns the origin of the blob. Not always available.
func (*Cache) ReverseURLFileAbsPath ¶
func (*Cache) ReverseURLFileRelPath ¶
func (*Cache) SHA256ByOriginURL ¶
SHA256ByOriginURL returns the sha256sum by the origin URL. Not always available.