Documentation ¶
Index ¶
- type MemoryBackend
- func (be *MemoryBackend) Close() error
- func (be *MemoryBackend) Delete(ctx context.Context) error
- func (be *MemoryBackend) Hasher() hash.Hash
- 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, ...) 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 restic.RewindReader) 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) Hasher ¶ added in v0.13.0
func (be *MemoryBackend) Hasher() hash.Hash
Hasher may return a hash function for calculating a content hash for 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, 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 (*MemoryBackend) Location ¶
func (be *MemoryBackend) Location() string
Location returns the location of the backend (RAM).
func (*MemoryBackend) Save ¶
func (be *MemoryBackend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error
Save adds new Data to the backend.
Click to show internal directories.
Click to hide internal directories.