Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrBadDir = errors.New("invalid directory") ErrBadSize = errors.New("storage size must be greater then zero") ErrBadCap = errors.New("file number must be greater then zero") ErrTooLarge = errors.New("file size must be less or equal storage size") )
Functions ¶
func NewDeflateWriter ¶
func NewDeflateWriter(w io.WriteCloser) io.WriteCloser
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func New ¶
New creates a Cache backed by dir on disk. The cache allows at most "cap" files of total size "size". If "useDeflate" is true, blobs will be compressed by lz4 for reduce disk usage.
func (*Cache) Get ¶
func (c *Cache) Get(key string) (io.ReadCloser, error)
Get returns a reader for a blob in the cache, or ErrNotFound otherwise.
func (*Cache) PutFile ¶
PutFile adds the contents of a file path as a blog to the cache. The source file will be moved or deleted.
type DeflateReader ¶
type DeflateReader struct {
// contains filtered or unexported fields
}
func NewDeflateReader ¶
func NewDeflateReader(r io.ReadCloser) *DeflateReader
func (*DeflateReader) Close ¶
func (d *DeflateReader) Close() error
Click to show internal directories.
Click to hide internal directories.