Documentation ¶
Index ¶
- func TestFastRetries(_ testing.TB)
- type Backend
- func (be *Backend) List(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error
- func (be *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64, ...) (err error)
- func (be *Backend) Remove(ctx context.Context, h restic.Handle) (err error)
- func (be *Backend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error
- func (be *Backend) Stat(ctx context.Context, h restic.Handle) (fi restic.FileInfo, err error)
- func (be *Backend) Unwrap() restic.Backend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestFastRetries ¶
TestFastRetries reduces the initial retry delay to 1 millisecond
Types ¶
type Backend ¶
type Backend struct { restic.Backend MaxTries int Report func(string, error, time.Duration) Success func(string, int) }
Backend retries operations on the backend in case of an error with a backoff.
func New ¶
func New(be restic.Backend, maxTries int, report func(string, error, time.Duration), success func(string, int)) *Backend
New wraps be with a backend that retries operations after a backoff. report is called with a description and the error, if one occurred. success is called with the number of retries before a successful operation (it is not called if it succeeded on the first try)
func (*Backend) List ¶
func (be *Backend) List(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error
List runs fn for each file in the backend which has the type t. When an error is returned by the underlying backend, the request is retried. When fn returns an error, the operation is aborted and the error is returned to the caller.
func (*Backend) Load ¶
func (be *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64, consumer func(rd io.Reader) error) (err error)
Load returns a reader that yields the contents of the file at h at the given offset. If length is larger than zero, only a portion of the file is returned. rd must be closed after use. If an error is returned, the ReadCloser must be nil.