local

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package local implements repository storage in a local directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseConfig

func ParseConfig(cfg string) (interface{}, error)

ParseConfig parses a local backend config.

Types

type Config

type Config struct {
	Path   string
	Layout string `option:"layout" help:"use this backend directory layout (default: auto-detect)"`
}

Config holds all information needed to open a local repository.

type Local

type Local struct {
	Config
	backend.Layout
}

Local is a backend in a local directory.

func Create

func Create(cfg Config) (*Local, error)

Create creates all the necessary files and directories for a new local backend at dir. Afterwards a new config blob should be created.

func Open

func Open(cfg Config) (*Local, error)

Open opens the local backend as specified by config.

func (*Local) Close

func (b *Local) Close() error

Close closes all open files.

func (*Local) Delete

func (b *Local) Delete(ctx context.Context) error

Delete removes the repository and all files.

func (*Local) IsNotExist

func (b *Local) IsNotExist(err error) bool

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

func (*Local) List

func (b *Local) 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 occurs (or fn returns an error), List stops and returns it.

func (*Local) Load

func (b *Local) 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 (*Local) Location

func (b *Local) Location() string

Location returns this backend's location (the directory name).

func (*Local) Remove

func (b *Local) Remove(ctx context.Context, h restic.Handle) error

Remove removes the blob with the given name and type.

func (*Local) Save

func (b *Local) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error

Save stores data in the backend at the handle.

func (*Local) Stat

func (b *Local) Stat(ctx context.Context, h restic.Handle) (restic.FileInfo, error)

Stat returns information about a blob.

func (*Local) Test

func (b *Local) Test(ctx context.Context, h restic.Handle) (bool, error)

Test returns true if a blob of the given type and name exists in the backend.

Jump to

Keyboard shortcuts

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