backend

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: BSD-2-Clause Imports: 20 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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 added in v0.16.0

func DefaultDelete(ctx context.Context, be restic.Backend) error

DefaultDelete removes all restic keys in the bucket. It will not remove the bucket itself.

func DefaultLoad added in v0.8.3

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 IsErrDot added in v0.15.0

func IsErrDot(err error) bool

func LoadAll

func LoadAll(ctx context.Context, buf []byte, be restic.Backend, h restic.Handle) ([]byte, error)

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 added in v0.14.0

func MemorizeList(ctx context.Context, be restic.Lister, t restic.FileType) (restic.Lister, error)

func ReadAt added in v0.14.0

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 added in v0.14.0

func ReaderAt(ctx context.Context, be restic.Backend, h restic.Handle) io.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 added in v0.9.0

func SplitShellStrings(data string) (strs []string, err error)

SplitShellStrings returns the list of shell strings from a shell command string.

func StartForeground added in v0.9.0

func StartForeground(cmd *exec.Cmd) (bg func() error, err error)

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 Modes

type Modes struct {
	Dir  os.FileMode
	File os.FileMode
}

func DeriveModesFromFileInfo added in v0.14.0

func DeriveModesFromFileInfo(fi os.FileInfo, err error) Modes

DeriveModesFromFileInfo will, given the mode of a regular file, compute the mode we should use for new files and directories. If the passed error is non-nil DefaultModes are returned.

type TransportOptions added in v0.8.2

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.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL