Documentation ¶
Index ¶
- type MemoryBackend
- func (be *MemoryBackend) Close() error
- func (be *MemoryBackend) Delete(ctx context.Context) error
- func (be *MemoryBackend) IsNotExist(err error) bool
- func (be *MemoryBackend) List(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error
- func (be *MemoryBackend) Load(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error)
- func (be *MemoryBackend) Location() string
- func (be *MemoryBackend) Remove(ctx context.Context, h restic.Handle) error
- func (be *MemoryBackend) Save(ctx context.Context, h restic.Handle, rd io.Reader) error
- func (be *MemoryBackend) Stat(ctx context.Context, h restic.Handle) (restic.FileInfo, error)
- func (be *MemoryBackend) Test(ctx context.Context, h restic.Handle) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryBackend ¶
type MemoryBackend struct {
// contains filtered or unexported fields
}
MemoryBackend is a mock backend that uses a map for storing all data in memory. This should only be used for tests.
func New ¶
func New() *MemoryBackend
New returns a new backend that saves all data in a map in memory.
func (*MemoryBackend) Delete ¶
func (be *MemoryBackend) Delete(ctx context.Context) error
Delete removes all data in the backend.
func (*MemoryBackend) IsNotExist ¶
func (be *MemoryBackend) IsNotExist(err error) bool
IsNotExist returns true if the file does not exist.
func (*MemoryBackend) List ¶
func (be *MemoryBackend) List(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error
List returns a channel which yields entries from the backend.
func (*MemoryBackend) Load ¶
func (be *MemoryBackend) Load(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error)
Load returns a reader that yields the contents of the file at h at the given offset. If length is nonzero, only a portion of the file is returned. rd must be closed after use.
func (*MemoryBackend) Location ¶
func (be *MemoryBackend) Location() string
Location returns the location of the backend (RAM).
Click to show internal directories.
Click to hide internal directories.