Documentation ¶
Overview ¶
Package cacher provides various blobref fetching caching mechanisms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachingFetcher ¶
type CachingFetcher struct {
// contains filtered or unexported fields
}
A CachingFetcher is a blobref.StreamingFetcher and a blobref.SeekFetcher.
func NewCachingFetcher ¶
func NewCachingFetcher(cache blobserver.Cache, fetcher blobref.StreamingFetcher) *CachingFetcher
NewCachingFetcher returns a CachingFetcher that fetches from fetcher and writes to and serves from cache.
func (*CachingFetcher) Fetch ¶
func (cf *CachingFetcher) Fetch(br *blobref.BlobRef) (file types.ReadSeekCloser, size int64, err error)
func (*CachingFetcher) FetchStreaming ¶
func (cf *CachingFetcher) FetchStreaming(br *blobref.BlobRef) (file io.ReadCloser, size int64, err error)
type DiskCache ¶
type DiskCache struct { *CachingFetcher // Root is the temp directory being used to store files. // It is available mostly for debug printing. Root string }
A DiskCache is a blobref.StreamingFetcher and blobref.SeekFetcher that serves from a local temp directory and is backed by a another blobref.StreamingFetcher (usually the pkg/client HTTP client).
func NewDiskCache ¶
func NewDiskCache(fetcher blobref.StreamingFetcher) (*DiskCache, error)
NewDiskCache returns a new DiskCache from a StreamingFetcher, which is usually the pkg/client HTTP client (which typically has much higher latency and lower bandwidth than local disk).