Documentation ¶
Index ¶
- Constants
- func ParseConfig(s string) (interface{}, error)
- func StripPassword(s string) string
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) Connections() uint
- func (b *Backend) Delete(ctx context.Context) error
- func (b *Backend) HasAtomicReplace() bool
- func (b *Backend) Hasher() hash.Hash
- 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)
- type Config
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.
func StripPassword ¶ added in v0.11.0
StripPassword removes the password from the URL If the repository location cannot be parsed as a valid URL, it will be returned as is (it's because this function is used for logging errors)
Types ¶
type Backend ¶ added in v0.9.0
Backend uses the REST protocol to access data stored on a server.
func Open ¶
func Open(cfg Config, rt http.RoundTripper) (*Backend, error)
Open opens the REST backend with the given config.
func (*Backend) Connections ¶ added in v0.14.0
func (*Backend) HasAtomicReplace ¶ added in v0.14.0
HasAtomicReplace returns whether Save() can atomically replace files
func (*Backend) Hasher ¶ added in v0.13.0
Hasher may return a hash function for calculating a content hash for the backend
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).