Documentation ¶
Index ¶
- Constants
- func ParseConfig(s string) (interface{}, error)
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) Delete(ctx context.Context) error
- func (b *Backend) IsNotExist(err error) bool
- func (b *Backend) List(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error
- func (b *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64, ...) error
- func (b *Backend) Location() string
- func (b *Backend) Remove(ctx context.Context, h restic.Handle) error
- func (b *Backend) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader) error
- func (b *Backend) Stat(ctx context.Context, h restic.Handle) (restic.FileInfo, error)
- func (b *Backend) Test(ctx context.Context, h restic.Handle) (bool, error)
- type Config
- type ErrIsNotExist
Constants ¶
const ( ContentTypeV1 = "application/vnd.x.restic.rest.v1" ContentTypeV2 = "application/vnd.x.restic.rest.v2" )
the REST API protocol version is decided by HTTP request headers, these are the constants.
Variables ¶
This section is empty.
Functions ¶
func ParseConfig ¶
ParseConfig parses the string s and extracts the REST server URL.
Types ¶
type Backend ¶ added in v0.9.0
Backend uses the REST protocol to access data stored on a server.
func Create ¶
func Create(cfg Config, rt http.RoundTripper) (*Backend, error)
Create creates a new REST on server configured in config.
func Open ¶
func Open(cfg Config, rt http.RoundTripper) (*Backend, error)
Open opens the REST backend with the given config.
func (*Backend) IsNotExist ¶ added in v0.9.0
IsNotExist returns true if the error was caused by a non-existing file.
func (*Backend) List ¶ added in v0.9.0
func (b *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 ¶ added in v0.9.0
func (b *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 ¶ added in v0.9.0
Location returns this backend's location (the server's URL).
type Config ¶
type Config struct { URL *url.URL Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"` }
Config contains all configuration necessary to connect to a REST server.
type ErrIsNotExist ¶
ErrIsNotExist is returned whenever the requested file does not exist on the server.
func (ErrIsNotExist) Error ¶
func (e ErrIsNotExist) Error() string