mock

package
v0.9.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2019 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	CloseFn      func() error
	IsNotExistFn func(err error) bool
	SaveFn       func(ctx context.Context, h restic.Handle, rd restic.RewindReader) error
	OpenReaderFn func(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error)
	StatFn       func(ctx context.Context, h restic.Handle) (restic.FileInfo, error)
	ListFn       func(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error
	RemoveFn     func(ctx context.Context, h restic.Handle) error
	TestFn       func(ctx context.Context, h restic.Handle) (bool, error)
	DeleteFn     func(ctx context.Context) error
	LocationFn   func() string
}

Backend implements a mock backend.

func NewBackend added in v0.8.3

func NewBackend() *Backend

NewBackend returns new mock Backend instance

func (*Backend) Close

func (m *Backend) Close() error

Close the backend.

func (*Backend) Delete

func (m *Backend) Delete(ctx context.Context) error

Delete all data.

func (*Backend) IsNotExist

func (m *Backend) IsNotExist(err error) bool

IsNotExist returns true if the error is caused by a missing file.

func (*Backend) List

func (m *Backend) List(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error

List items of type t.

func (*Backend) Load

func (m *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64, fn func(rd io.Reader) error) error

Load runs fn with a reader that yields the contents of the file at h at the given offset.

func (*Backend) Location

func (m *Backend) Location() string

Location returns a location string.

func (*Backend) Remove

func (m *Backend) Remove(ctx context.Context, h restic.Handle) error

Remove data from the backend.

func (*Backend) Save

Save data in the backend.

func (*Backend) Stat

func (m *Backend) Stat(ctx context.Context, h restic.Handle) (restic.FileInfo, error)

Stat an object in the backend.

func (*Backend) Test

func (m *Backend) Test(ctx context.Context, h restic.Handle) (bool, error)

Test for the existence of a specific item.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL