Documentation ¶
Overview ¶
Package restic is the top level package for the restic backup program, please see https://github.com/restic/restic for more information.
This package exposes the main components needed to create and restore a backup as well as handling things like a local cache of objects.
Index ¶
- Variables
- func FindSnapshot(repo *repository.Repository, s string) (backend.ID, error)
- func IsAlreadyLocked(err error) bool
- func RemoveAllLocks(repo *repository.Repository) error
- func RemoveStaleLocks(repo *repository.Repository) error
- func WalkTree(repo *repository.Repository, id backend.ID, done chan struct{}, ...)
- type Archiver
- func (arch *Archiver) Save(t pack.BlobType, id backend.ID, length uint, rd io.Reader) error
- func (arch *Archiver) SaveFile(p *Progress, node *Node) error
- func (arch *Archiver) SaveTreeJSON(item interface{}) (backend.ID, error)
- func (arch *Archiver) Snapshot(p *Progress, paths []string, parentID *backend.ID) (*Snapshot, backend.ID, error)
- type Cache
- func (c *Cache) Clear(repo *repository.Repository) error
- func (c *Cache) Has(t backend.Type, subtype string, id backend.ID) (bool, error)
- func (c *Cache) Load(t backend.Type, subtype string, id backend.ID) (io.ReadCloser, error)
- func (c *Cache) Store(t backend.Type, subtype string, id backend.ID) (io.WriteCloser, error)
- type ErrAlreadyLocked
- type Lock
- type Node
- func (node *Node) CreateAt(path string, repo *repository.Repository) error
- func (node Node) Equals(other Node) bool
- func (node Node) MarshalJSON() ([]byte, error)
- func (node *Node) OpenForReading() (*os.File, error)
- func (node Node) RestoreTimestamps(path string) error
- func (node Node) String() string
- func (node Node) Tree() *Tree
- func (node *Node) UnmarshalJSON(data []byte) error
- type Progress
- type ProgressFunc
- type Restorer
- type Snapshot
- type Stat
- type Tree
- type WalkTreeJob
Constants ¶
This section is empty.
Variables ¶
var ( ErrNodeNotFound = errors.New("named node not found") ErrNodeAlreadyInTree = errors.New("node already present") )
Functions ¶
func FindSnapshot ¶
func FindSnapshot(repo *repository.Repository, s string) (backend.ID, error)
FindSnapshot takes a string and tries to find a snapshot whose ID matches the string as closely as possible.
func IsAlreadyLocked ¶
IsAlreadyLocked returns true iff err is an instance of ErrAlreadyLocked.
func RemoveAllLocks ¶
func RemoveAllLocks(repo *repository.Repository) error
RemoveAllLocks removes all locks forcefully.
func RemoveStaleLocks ¶
func RemoveStaleLocks(repo *repository.Repository) error
RemoveStaleLocks deletes all locks detected as stale from the repository.
func WalkTree ¶
func WalkTree(repo *repository.Repository, id backend.ID, done chan struct{}, jobCh chan<- WalkTreeJob)
WalkTree walks the tree specified by id recursively and sends a job for each file and directory it finds. When the channel done is closed, processing stops.
Types ¶
type Archiver ¶
type Archiver struct { Error func(dir string, fi os.FileInfo, err error) error SelectFilter pipe.SelectFunc Excludes []string // contains filtered or unexported fields }
Archiver is used to backup a set of directories.
func NewArchiver ¶
func NewArchiver(repo *repository.Repository) *Archiver
NewArchiver returns a new archiver.
func (*Archiver) SaveFile ¶
SaveFile stores the content of the file on the backend as a Blob by calling Save for each chunk.
func (*Archiver) SaveTreeJSON ¶
SaveTreeJSON stores a tree in the repository.
func (*Archiver) Snapshot ¶
func (arch *Archiver) Snapshot(p *Progress, paths []string, parentID *backend.ID) (*Snapshot, backend.ID, error)
Snapshot creates a snapshot of the given paths. If parentID is set, this is used to compare the files to the ones archived at the time this snapshot was taken.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is used to locally cache items from a repository.
func NewCache ¶
func NewCache(repo *repository.Repository, cacheDir string) (*Cache, error)
NewCache returns a new cache at cacheDir. If it is the empty string, the default cache location is chosen.
func (*Cache) Clear ¶
func (c *Cache) Clear(repo *repository.Repository) error
Clear removes information from the cache that isn't present in the repository any more.
type ErrAlreadyLocked ¶
type ErrAlreadyLocked struct {
// contains filtered or unexported fields
}
ErrAlreadyLocked is returned when NewLock or NewExclusiveLock are unable to acquire the desired lock.
func (ErrAlreadyLocked) Error ¶
func (e ErrAlreadyLocked) Error() string
type Lock ¶
type Lock struct { Time time.Time `json:"time"` Exclusive bool `json:"exclusive"` Hostname string `json:"hostname"` Username string `json:"username"` PID int `json:"pid"` UID uint32 `json:"uid,omitempty"` GID uint32 `json:"gid,omitempty"` // contains filtered or unexported fields }
Lock represents a process locking the repository for an operation.
There are two types of locks: exclusive and non-exclusive. There may be many different non-exclusive locks, but at most one exclusive lock, which can only be acquired while no non-exclusive lock is held.
A lock must be refreshed regularly to not be considered stale, this must be triggered by regularly calling Refresh.
func LoadLock ¶
func LoadLock(repo *repository.Repository, id backend.ID) (*Lock, error)
LoadLock loads and unserializes a lock from a repository.
func NewExclusiveLock ¶
func NewExclusiveLock(repo *repository.Repository) (*Lock, error)
NewExclusiveLock returns a new, exclusive lock for the repository. If another lock (normal and exclusive) is already held by another process, ErrAlreadyLocked is returned.
func NewLock ¶
func NewLock(repo *repository.Repository) (*Lock, error)
NewLock returns a new, non-exclusive lock for the repository. If an exclusive lock is already held by another process, ErrAlreadyLocked is returned.
func (*Lock) Refresh ¶
Refresh refreshes the lock by creating a new file in the backend with a new timestamp. Afterwards the old lock is removed.
type Node ¶
type Node struct { Name string `json:"name"` Type string `json:"type"` Mode os.FileMode `json:"mode,omitempty"` ModTime time.Time `json:"mtime,omitempty"` AccessTime time.Time `json:"atime,omitempty"` ChangeTime time.Time `json:"ctime,omitempty"` UID uint32 `json:"uid"` GID uint32 `json:"gid"` User string `json:"user,omitempty"` Group string `json:"group,omitempty"` Inode uint64 `json:"inode,omitempty"` Size uint64 `json:"size,omitempty"` Links uint64 `json:"links,omitempty"` LinkTarget string `json:"linktarget,omitempty"` Device uint64 `json:"device,omitempty"` Content []backend.ID `json:"content"` Subtree *backend.ID `json:"subtree,omitempty"` Error string `json:"error,omitempty"` // contains filtered or unexported fields }
Node is a file, directory or other item in a backup.
func NodeFromFileInfo ¶
NodeFromFileInfo returns a new node from the given path and FileInfo.
func (*Node) CreateAt ¶
func (node *Node) CreateAt(path string, repo *repository.Repository) error
CreateAt creates the node at the given path and restores all the meta data.
func (Node) MarshalJSON ¶
func (Node) RestoreTimestamps ¶
func (*Node) UnmarshalJSON ¶
type Progress ¶
type Progress struct { OnStart func() OnUpdate ProgressFunc OnDone ProgressFunc // contains filtered or unexported fields }
func NewProgress ¶
NewProgress returns a new progress reporter. When Start() is called, the function OnStart is executed once. Afterwards the function OnUpdate is called when new data arrives or at least every d interval. The function OnDone is called when Done() is called. Both functions are called synchronously and can use shared state.
type Restorer ¶
type Restorer struct { Error func(dir string, node *Node, err error) error SelectFilter func(item string, dstpath string, node *Node) bool // contains filtered or unexported fields }
Restorer is used to restore a snapshot to a directory.
func NewRestorer ¶
func NewRestorer(repo *repository.Repository, id backend.ID) (*Restorer, error)
NewRestorer creates a restorer preloaded with the content from the snapshot id.
type Snapshot ¶
type Snapshot struct { Time time.Time `json:"time"` Parent *backend.ID `json:"parent,omitempty"` Tree *backend.ID `json:"tree"` Paths []string `json:"paths"` Hostname string `json:"hostname,omitempty"` Username string `json:"username,omitempty"` UID uint32 `json:"uid,omitempty"` GID uint32 `json:"gid,omitempty"` Excludes []string `json:"excludes,omitempty"` // contains filtered or unexported fields }
func LoadSnapshot ¶
func LoadSnapshot(repo *repository.Repository, id backend.ID) (*Snapshot, error)
func NewSnapshot ¶
type Stat ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/bazil.org/fuse
Package fuse enables writing FUSE file systems on Linux, OS X, and FreeBSD.
|
Package fuse enables writing FUSE file systems on Linux, OS X, and FreeBSD. |
_workspace/src/bazil.org/fuse/examples/clockfs
Clockfs implements a file system with the current time in a file.
|
Clockfs implements a file system with the current time in a file. |
_workspace/src/bazil.org/fuse/examples/hellofs
Hellofs implements a simple "hello world" file system.
|
Hellofs implements a simple "hello world" file system. |
_workspace/src/bazil.org/fuse/fs/bench
Package bench contains benchmarks.
|
Package bench contains benchmarks. |
_workspace/src/bazil.org/fuse/syscallx
Package syscallx provides wrappers that make syscalls on various platforms more interoperable.
|
Package syscallx provides wrappers that make syscalls on various platforms more interoperable. |
_workspace/src/github.com/jessevdk/go-flags
Package flags provides an extensive command line option parser.
|
Package flags provides an extensive command line option parser. |
_workspace/src/github.com/juju/errors
[godoc-link-here] The juju/errors provides an easy way to annotate errors without losing the orginal error context.
|
[godoc-link-here] The juju/errors provides an easy way to annotate errors without losing the orginal error context. |
_workspace/src/github.com/kr/fs
Package fs provides filesystem-related functions.
|
Package fs provides filesystem-related functions. |
_workspace/src/github.com/mitchellh/goamz/aws
goamz - Go packages to interact with the Amazon Web Services.
|
goamz - Go packages to interact with the Amazon Web Services. |
_workspace/src/github.com/pkg/sftp
Package sftp implements the SSH File Transfer Protocol as described in https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
|
Package sftp implements the SSH File Transfer Protocol as described in https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt |
_workspace/src/github.com/pkg/sftp/examples/buffered-read-benchmark
buffered-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to a []byte on the client via io.Copy.
|
buffered-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to a []byte on the client via io.Copy. |
_workspace/src/github.com/pkg/sftp/examples/buffered-write-benchmark
buffered-write-benchmark benchmarks the peformance of writing a single large []byte on the client to /dev/null on the server via io.Copy.
|
buffered-write-benchmark benchmarks the peformance of writing a single large []byte on the client to /dev/null on the server via io.Copy. |
_workspace/src/github.com/pkg/sftp/examples/streaming-read-benchmark
streaming-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to /dev/null on the client via io.Copy.
|
streaming-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to /dev/null on the client via io.Copy. |
_workspace/src/github.com/pkg/sftp/examples/streaming-write-benchmark
streaming-write-benchmark benchmarks the peformance of writing from /dev/zero on the client to /dev/null on the server via io.Copy.
|
streaming-write-benchmark benchmarks the peformance of writing from /dev/zero on the client to /dev/null on the server via io.Copy. |
_workspace/src/github.com/restic/chunker
Package chunker implements Content Defined Chunking (CDC) based on a rolling Rabin Checksum.
|
Package chunker implements Content Defined Chunking (CDC) based on a rolling Rabin Checksum. |
_workspace/src/github.com/vaughan0/go-ini
Package ini provides functions for parsing INI configuration files.
|
Package ini provides functions for parsing INI configuration files. |
_workspace/src/golang.org/x/crypto/pbkdf2
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
|
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0. |
_workspace/src/golang.org/x/crypto/poly1305
Package poly1305 implements Poly1305 one-time message authentication code as specified in http://cr.yp.to/mac/poly1305-20050329.pdf.
|
Package poly1305 implements Poly1305 one-time message authentication code as specified in http://cr.yp.to/mac/poly1305-20050329.pdf. |
_workspace/src/golang.org/x/crypto/scrypt
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf).
|
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf). |
_workspace/src/golang.org/x/crypto/ssh
Package ssh implements an SSH client and server.
|
Package ssh implements an SSH client and server. |
_workspace/src/golang.org/x/crypto/ssh/agent
Package agent implements a client to an ssh-agent daemon.
|
Package agent implements a client to an ssh-agent daemon. |
_workspace/src/golang.org/x/crypto/ssh/terminal
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
|
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems. |
_workspace/src/golang.org/x/crypto/ssh/test
This package contains integration tests for the golang.org/x/crypto/ssh package.
|
This package contains integration tests for the golang.org/x/crypto/ssh package. |
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
|
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes. |
Package backend provides local and remote storage for restic repositories.
|
Package backend provides local and remote storage for restic repositories. |
local
Package local implements repository storage in a local directory.
|
Package local implements repository storage in a local directory. |
sftp
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. |
cmd
|
|
restic
This package contains the code for the restic executable.
|
This package contains the code for the restic executable. |
Package crypto provides all cryptographic operations needed in restic.
|
Package crypto provides all cryptographic operations needed in restic. |
Package debug provides an infrastructure for logging debug information and breakpoints.
|
Package debug provides an infrastructure for logging debug information and breakpoints. |
Package filter implements filters for files similar to filepath.Glob, but in contrast to filepath.Glob a pattern may specify directories.
|
Package filter implements filters for files similar to filepath.Glob, but in contrast to filepath.Glob a pattern may specify directories. |
Package pack provides functions for combining and parsing pack files.
|
Package pack provides functions for combining and parsing pack files. |
Package pipe implements walking a directory in a deterministic order.
|
Package pipe implements walking a directory in a deterministic order. |
Package repository implements a restic repository on top of a backend.
|
Package repository implements a restic repository on top of a backend. |
Package test_helper provides helper functions for writing tests for restic.
|
Package test_helper provides helper functions for writing tests for restic. |