Documentation ¶
Index ¶
- Constants
- func All(basedir string) (dirs []os.FileInfo, err error)
- func DefaultDir() (cachedir string, err error)
- func EnvDir() string
- func IsOld(t time.Time, maxAge time.Duration) bool
- func Old(basedir string) ([]os.FileInfo, error)
- func OlderThan(basedir string, max time.Duration) ([]os.FileInfo, error)
- type Backend
- func (b *Backend) IsNotExist(err error) bool
- func (b *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64, ...) error
- func (b *Backend) Remove(ctx context.Context, h restic.Handle) error
- func (b *Backend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error
- func (b *Backend) Stat(ctx context.Context, h restic.Handle) (restic.FileInfo, error)
- type Cache
Constants ¶
const MaxCacheAge = 30 * 24 * time.Hour
MaxCacheAge is the default age (30 days) after which cache directories are considered old.
Variables ¶
This section is empty.
Functions ¶
func DefaultDir ¶ added in v0.8.1
DefaultDir returns $RESTIC_CACHE_DIR, or the default cache directory for the current OS if that variable is not set.
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, consumer func(rd io.Reader) error) 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.