Documentation ¶
Index ¶
- func BasePath(checksum, uri string) string
- func Download(client *http.Client, header http.Header, uri, file string) (w *os.File, response *http.Response, err error)
- type Cache
- func (c *Cache) Clean() error
- func (c *Cache) Create(checksum, uri string) (*os.File, error)
- func (c *Cache) Download(b *ui.Task, checksum, uri string, mirrors ...string) (path string, etag string, err error)
- func (c *Cache) ETag(b *ui.Task, uri string, mirrors ...string) (etag string, err error)
- func (c *Cache) Evict(b *ui.Task, checksum, uri string) error
- func (c *Cache) IsCached(checksum, uri string) bool
- func (c *Cache) Mkdir(uri string) (string, error)
- func (c *Cache) Open(b *ui.Task, checksum, uri string, mirrors ...string) (*os.File, error)
- func (c *Cache) OpenLocal(checksum, uri string) (*os.File, error)
- func (c *Cache) Path(checksum, uri string) string
- func (c *Cache) Root() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Download ¶
func Download(client *http.Client, header http.Header, uri, file string) (w *os.File, response *http.Response, err error)
Download a file with resumption.
On return "w" will be either at the beginning of the file, or at the resumption point.
response.ContentLength will be the number of bytes remaining.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache manages the Hermit cache.
func Open ¶
Open or create a Cache at the given directory, using the given http client.
"fastFailClient" is a HTTP client configured to fail quickly if a remote server is unavailable, for use in optional checks.
func (*Cache) Download ¶
func (c *Cache) Download(b *ui.Task, checksum, uri string, mirrors ...string) (path string, etag string, err error)
Download a local or remote artifact, transparently caching it.
If checksum is present it must be the SHA256 hash of the downloaded artifact.
func (*Cache) ETag ¶
ETag fetches the etag from given URI if available. Otherwise an empty string is returned
func (*Cache) Open ¶
Open a local or remote artifact, transparently caching it. Subsequent accesses will use the cached copy.
If checksum is present it must be the SHA256 hash of the downloaded artifact.