Documentation ¶
Overview ¶
Package backend provides local and remote storage for restic repositories.
Index ¶
- Constants
- Variables
- func Find(be Lister, t Type, prefix string) (string, error)
- func LimitReadCloser(r io.ReadCloser, n int64) *blobReader
- func PrefixLength(be Lister, t Type) (int, error)
- type Backend
- type Blob
- type Deleter
- type HashAppendReader
- type HashAppendWriter
- type HashingReader
- type HashingWriter
- type ID
- type IDs
- type Lister
- type Type
Constants ¶
View Source
const ( Data Type = "data" Key = "key" Lock = "lock" Snapshot = "snapshot" Index = "index" Config = "config" )
View Source
const IDSize = hashSize
IDSize contains the size of an ID, in bytes.
View Source
const (
MinPrefixLength = 8
)
Variables ¶
View Source
var ( ErrNoIDPrefixFound = errors.New("no ID found") ErrMultipleIDMatches = errors.New("multiple IDs with prefix found") )
View Source
var Modes = struct{ Dir, File os.FileMode }{0700, 0600}
Default modes for file-based backends
View Source
var Paths = struct { Data string Snapshots string Index string Locks string Keys string Temp string Config string }{ "data", "snapshots", "index", "locks", "keys", "tmp", "config", }
Default paths for file-based backends (e.g. local)
Functions ¶
func Find ¶
Find loads the list of all blobs of type t and searches for names which start with prefix. If none is found, nil and ErrNoIDPrefixFound is returned. If more than one is found, nil and ErrMultipleIDMatches is returned.
func LimitReadCloser ¶
func LimitReadCloser(r io.ReadCloser, n int64) *blobReader
LimitReadCloser returns a new reader wraps r in an io.LimitReader, but also implements the Close() method.
Types ¶
type Backend ¶
type Backend interface { // Location returns a string that specifies the location of the repository, // like a URL. Location() string // Create creates a new Blob. The data is available only after Finalize() // has been called on the returned Blob. Create() (Blob, error) // Get returns an io.ReadCloser for the Blob with the given name of type t. Get(t Type, name string) (io.ReadCloser, error) // GetReader returns an io.ReadCloser for the Blob with the given name of // type t at offset and length. GetReader(t Type, name string, offset, length uint) (io.ReadCloser, error) // Test a boolean value whether a Blob with the name and type exists. Test(t Type, name string) (bool, error) // Remove removes a Blob with type t and name. Remove(t Type, name string) error // Close the backend Close() error Lister }
A Backend manages data stored somewhere.
type HashAppendReader ¶
type HashAppendReader struct {
// contains filtered or unexported fields
}
func NewHashAppendReader ¶
func NewHashAppendReader(r io.Reader, h hash.Hash) *HashAppendReader
type HashAppendWriter ¶
type HashAppendWriter struct {
// contains filtered or unexported fields
}
func NewHashAppendWriter ¶
func NewHashAppendWriter(w io.Writer, h hash.Hash) *HashAppendWriter
func (*HashAppendWriter) Close ¶
func (h *HashAppendWriter) Close() error
type HashingReader ¶
type HashingReader struct {
// contains filtered or unexported fields
}
func NewHashingReader ¶
func NewHashingReader(r io.Reader, h hash.Hash) *HashingReader
func (*HashingReader) Sum ¶
func (h *HashingReader) Sum(d []byte) []byte
type HashingWriter ¶
type HashingWriter struct {
// contains filtered or unexported fields
}
func NewHashingWriter ¶
func NewHashingWriter(w io.Writer, h hash.Hash) *HashingWriter
func (*HashingWriter) Size ¶
func (h *HashingWriter) Size() int
func (*HashingWriter) Sum ¶
func (h *HashingWriter) Sum(d []byte) []byte
type ID ¶
ID references content within a repository.
func IDFromData ¶
func (ID) EqualString ¶
EqualString compares this ID to another one, given as a string.
func (ID) MarshalJSON ¶
func (*ID) UnmarshalJSON ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package local implements repository storage in a local directory.
|
Package local implements repository storage in a local directory. |
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. |
Click to show internal directories.
Click to hide internal directories.