Documentation ¶
Index ¶
- type Backend
- func (b *Backend) IsNotExist(err error) bool
- func (b *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error)
- func (b *Backend) Remove(ctx context.Context, h restic.Handle) error
- func (b *Backend) Save(ctx context.Context, h restic.Handle, rd io.Reader) (err error)
- func (b *Backend) Stat(ctx context.Context, h restic.Handle) (restic.FileInfo, error)
- type Cache
- func (c *Cache) BaseDir() string
- func (c *Cache) Clear(t restic.FileType, valid restic.IDSet) error
- func (c *Cache) Has(h restic.Handle) bool
- func (c *Cache) IsNotExist(err error) bool
- func (c *Cache) Load(h restic.Handle, length int, offset int64) (io.ReadCloser, error)
- func (c *Cache) Remove(h restic.Handle) error
- func (c *Cache) Save(h restic.Handle, rd io.Reader) error
- func (c *Cache) SaveWriter(h restic.Handle) (io.WriteCloser, error)
- func (c *Cache) Wrap(be restic.Backend) restic.Backend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
Backend wraps a restic.Backend and adds a cache.
func (*Backend) IsNotExist ¶
IsNotExist returns true if the error is caused by a non-existing file.
func (*Backend) Load ¶
func (b *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error)
Load loads a file from the cache or the backend.
func (*Backend) Remove ¶
Remove deletes a file from the backend and the cache if it has been cached.
type Cache ¶
Cache manages a local cache.
func New ¶
New returns a new cache for the repo ID at basedir. If basedir is the empty string, the default cache location (according to the XDG standard) is used.
For partial files, the complete file is loaded and stored in the cache when performReadahead returns true.
func TestNewCache ¶
TestNewCache returns a cache in a temporary directory which is removed when cleanup is called.
func (*Cache) Clear ¶
Clear removes all files of type t from the cache that are not contained in the set valid.
func (*Cache) IsNotExist ¶
IsNotExist returns true if the error was caused by a non-existing file.
func (*Cache) Load ¶
Load returns a reader that yields the contents of the file with the given handle. rd must be closed after use. If an error is returned, the ReadCloser is nil.
func (*Cache) SaveWriter ¶
SaveWriter returns a writer for the cache object h. It must be closed after writing is finished.