s3

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create added in v0.7.0

func Create(cfg Config) (restic.Backend, error)

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

func Open

func Open(cfg Config) (restic.Backend, error)

Open opens the S3 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 s3 config. The two supported configuration formats are s3://host/bucketname/prefix and s3:host:bucketname/prefix. The host can also be a valid s3 region name. If no prefix is given the prefix "restic" will be used.

Types

type Backend added in v0.7.0

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

Backend stores data on an S3 endpoint.

func (*Backend) Close added in v0.7.0

func (be *Backend) Close() error

Close does nothing

func (*Backend) Delete added in v0.7.0

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) IsNotExist added in v0.7.0

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

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

func (*Backend) Join added in v0.7.0

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

Join combines path components with slashes.

func (*Backend) List added in v0.7.0

func (be *Backend) List(ctx context.Context, t restic.FileType) <-chan string

List returns a channel that yields all names of blobs of type t. A goroutine is started for this. If the channel done is closed, sending stops.

func (*Backend) Load added in v0.7.0

func (be *Backend) 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 (*Backend) Location added in v0.7.0

func (be *Backend) Location() string

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

func (*Backend) Path added in v0.7.0

func (be *Backend) Path() string

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

func (*Backend) ReadDir added in v0.7.0

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

ReadDir returns the entries for a directory.

func (*Backend) Remove added in v0.7.0

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

Remove removes the blob with the given name and type.

func (*Backend) Rename added in v0.7.0

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

Rename moves a file based on the new layout l.

func (*Backend) Save added in v0.7.0

func (be *Backend) Save(ctx context.Context, h restic.Handle, rd io.Reader) (err error)

Save stores data in the backend at the handle.

func (*Backend) Stat added in v0.7.0

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

Stat returns information about a blob.

func (*Backend) Test added in v0.7.0

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 {
	Endpoint      string
	UseHTTP       bool
	KeyID, Secret string
	Bucket        string
	Prefix        string
	Layout        string `option:"layout" help:"use this backend layout (default: auto-detect)"`

	Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
	MaxRetries  uint `option:"retries" help:"set the number of retries attempted"`
}

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

func NewConfig added in v0.7.0

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