Documentation ¶
Index ¶
- func Create(cfg Config, rt http.RoundTripper) (restic.Backend, error)
- func Open(cfg Config, rt http.RoundTripper) (restic.Backend, error)
- func ParseConfig(s string) (interface{}, error)
- type Backend
- func (be *Backend) Close() error
- func (be *Backend) Delete(ctx context.Context) error
- func (be *Backend) IsNotExist(err error) bool
- func (be *Backend) Join(p ...string) string
- func (be *Backend) List(ctx context.Context, t restic.FileType) <-chan string
- func (be *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error)
- func (be *Backend) Location() string
- func (be *Backend) Path() string
- func (be *Backend) ReadDir(dir string) (list []os.FileInfo, err error)
- func (be *Backend) Remove(ctx context.Context, h restic.Handle) error
- func (be *Backend) Rename(h restic.Handle, l backend.Layout) error
- func (be *Backend) Save(ctx context.Context, h restic.Handle, rd io.Reader) (err error)
- func (be *Backend) Stat(ctx context.Context, h restic.Handle) (bi restic.FileInfo, err error)
- func (be *Backend) Test(ctx context.Context, h restic.Handle) (bool, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create opens the S3 backend at bucket and region and creates the bucket if it does not exist yet.
func Open ¶
Open opens the S3 backend at bucket and region. The bucket is created if it does not exist yet.
func ParseConfig ¶
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 ¶
Backend stores data on an S3 endpoint.
func (*Backend) Delete ¶
Delete removes all restic keys in the bucket. It will not remove the bucket itself.
func (*Backend) IsNotExist ¶
IsNotExist returns true if the error is caused by a not existing file.
func (*Backend) List ¶
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 ¶
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.
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.