Documentation ¶
Index ¶
- Constants
- func NewFactory() location.Factory
- 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) IsPermanentError(err error) bool
- func (b *Backend) List(ctx context.Context, t backend.FileType, fn func(backend.FileInfo) error) error
- func (b *Backend) Load(ctx context.Context, h backend.Handle, length int, offset int64, ...) error
- func (b *Backend) Remove(ctx context.Context, h backend.Handle) error
- func (b *Backend) Save(ctx context.Context, h backend.Handle, rd backend.RewindReader) error
- func (b *Backend) Stat(ctx context.Context, h backend.Handle) (backend.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 NewFactory ¶
func StripPassword ¶
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 ¶
Backend uses the REST protocol to access data stored on a server.
func (*Backend) Connections ¶
func (*Backend) HasAtomicReplace ¶
HasAtomicReplace returns whether Save() can atomically replace files
func (*Backend) Hasher ¶
Hasher may return a hash function for calculating a content hash for the backend
func (*Backend) IsNotExist ¶
IsNotExist returns true if the error was caused by a non-existing file.
func (*Backend) IsPermanentError ¶
func (*Backend) List ¶
func (b *Backend) List(ctx context.Context, t backend.FileType, fn func(backend.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 (b *Backend) Load(ctx context.Context, h backend.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.
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.
func NewConfig ¶
func NewConfig() Config
NewConfig returns a new Config with the default values filled in.
func ParseConfig ¶
ParseConfig parses the string s and extracts the REST server URL.
func (*Config) ApplyEnvironment ¶
ApplyEnvironment saves values from the environment to the config.