fds

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, cfg Config) (restic.Backend, error)

Create opens the fds backend at bucket and region and creates the bucket if it does not exist yet.

func Open

func Open(ctx context.Context, cfg Config) (restic.Backend, error)

Open opens the fds backend at bucket and region. The bucket is created if it does not exist yet.

func ParseConfig

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

ParseConfig parses the string s and extracts the fds config. The two supported configuration formats are fds://host/bucketname/prefix and fds:host/bucketname/prefix. The host can also be a valid fds region name. If no prefix is given the prefix "restic" will be used.

Types

type Backend

type Backend struct {
	backend.Layout
	// contains filtered or unexported fields
}

Backend stores data on an fds endpoint.

func (*Backend) Close

func (be *Backend) Close() error

Close does nothing

func (*Backend) Delete

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

Delete removes all restic keys in the bucket. It will not remove the bucket itself.

func (*Backend) IsAccessDenied

func (be *Backend) IsAccessDenied(err error) bool

IsAccessDenied returns true if the error is caused by Access Denied.

func (*Backend) IsNotExist

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

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

func (*Backend) Join

func (be *Backend) Join(p ...string) string

Join combines path components with slashes.

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

func (*Backend) Load

func (be *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 (be *Backend) Location() string

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

func (*Backend) Path

func (be *Backend) Path() string

Path returns the path in the bucket that is used for this backend.

func (*Backend) ReadDir

func (be *Backend) ReadDir(ctx context.Context, dir string) (list []os.FileInfo, err error)

ReadDir returns the entries for a directory.

func (*Backend) Remove

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

Remove removes the blob with the given name and type.

func (*Backend) Rename

func (be *Backend) Rename(ctx context.Context, h restic.Handle, l backend.Layout) error

Rename moves a file based on the new layout l.

func (*Backend) Save

Save stores data in the backend at the handle.

func (*Backend) Stat

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

Stat returns information about a blob.

func (*Backend) Test

func (be *Backend) 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.

type Config

type Config struct {
	FdsEndpoint        string
	FdsAccessKeyID     string
	FdsAccessKeySecret string
	Bucket             string
	Prefix             string
	Connections        uint   `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
	Layout             string `option:"layout" help:"use this backend layout (default: auto-detect)"`
}

Config contains all configuration necessary to connect to an fds compatible server.

func NewConfig

func NewConfig() Config

NewConfig returns a new Config with the default values filled in.

Jump to

Keyboard shortcuts

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