Documentation ¶
Overview ¶
Package backend provides local and remote storage for restic repositories. All backends need to implement the Backend interface. There is a MemBackend, which stores all data in a map internally and can be used for testing.
Index ¶
- Variables
- func DefaultDelete(ctx context.Context, be restic.Backend) error
- func DefaultLoad(ctx context.Context, h restic.Handle, length int, offset int64, ...) error
- func IsErrDot(err error) bool
- func LoadAll(ctx context.Context, buf []byte, be restic.Backend, h restic.Handle) ([]byte, error)
- func MemorizeList(ctx context.Context, be restic.Lister, t restic.FileType) (restic.Lister, error)
- func ReadAt(ctx context.Context, be restic.Backend, h restic.Handle, offset int64, ...) (n int, err error)
- func ReaderAt(ctx context.Context, be restic.Backend, h restic.Handle) io.ReaderAt
- func SplitShellStrings(data string) (strs []string, err error)
- func StartForeground(cmd *exec.Cmd) (bg func() error, err error)
- func Transport(opts TransportOptions) (http.RoundTripper, error)
- type LimitedReadCloser
- type Modes
- type TransportOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultModes = Modes{Dir: 0700, File: 0600}
DefaultModes defines the default permissions to apply to new repository files and directories stored on file-based backends.
Functions ¶
func DefaultDelete ¶
DefaultDelete removes all restic keys in the bucket. It will not remove the bucket itself.
func DefaultLoad ¶
func DefaultLoad(ctx context.Context, h restic.Handle, length int, offset int64, openReader func(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error), fn func(rd io.Reader) error) error
DefaultLoad implements Backend.Load using lower-level openReader func
func LoadAll ¶
LoadAll reads all data stored in the backend for the handle into the given buffer, which is truncated. If the buffer is not large enough or nil, a new one is allocated.
func MemorizeList ¶
func ReadAt ¶
func ReadAt(ctx context.Context, be restic.Backend, h restic.Handle, offset int64, p []byte) (n int, err error)
ReadAt reads from the backend handle h at the given position.
func ReaderAt ¶
ReaderAt returns an io.ReaderAt for a file in the backend. The returned reader should not escape the caller function to avoid unexpected interactions with the embedded context
func SplitShellStrings ¶
SplitShellStrings returns the list of shell strings from a shell command string.
func StartForeground ¶
StartForeground runs cmd in the foreground, by temporarily switching to the new process group created for cmd. The returned function `bg` switches back to the previous process group.
The command's environment has all RESTIC_* variables removed.
func Transport ¶
func Transport(opts TransportOptions) (http.RoundTripper, error)
Transport returns a new http.RoundTripper with default settings applied. If a custom rootCertFilename is non-empty, it must point to a valid PEM file, otherwise the function will return an error.
Types ¶
type LimitedReadCloser ¶
type LimitedReadCloser struct { io.Closer io.LimitedReader }
LimitedReadCloser wraps io.LimitedReader and exposes the Close() method.
func LimitReadCloser ¶
func LimitReadCloser(r io.ReadCloser, n int64) *LimitedReadCloser
LimitReadCloser returns a new reader wraps r in an io.LimitedReader, but also exposes the Close() method.
type TransportOptions ¶
type TransportOptions struct { // contains filenames of PEM encoded root certificates to trust RootCertFilenames []string // contains the name of a file containing the TLS client certificate and private key in PEM format TLSClientCertKeyFilename string // Skip TLS certificate verification InsecureTLS bool }
TransportOptions collects various options which can be set for an HTTP based transport.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package gs provides a restic backend for Google Cloud Storage.
|
Package gs provides a restic backend for Google Cloud Storage. |
Package local implements repository storage in a local directory.
|
Package local implements repository storage in a local directory. |
Package location implements parsing the restic repository location from a string.
|
Package location implements parsing the restic repository location from a string. |
Package sema implements semaphores.
|
Package sema implements semaphores. |
Package sftp implements repository storage in a directory on a remote server via the sftp protocol.
|
Package sftp implements repository storage in a directory on a remote server via the sftp protocol. |
Package test contains a test suite with benchmarks for restic backends.
|
Package test contains a test suite with benchmarks for restic backends. |