backup

package
v0.0.0-...-7234002 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadVersion = errors.New("bad version")
View Source
var ErrMalformedConfig = errors.New("malformed config data")

Functions

func RestoreToPath

func RestoreToPath(bucket *store.Store, root string, incl []string) error

Restore changed files from the store to a particular folder. Will do an incremental restore and only write the files that are different.

func ScanAndBackup

func ScanAndBackup(bucket *store.Store, scanner *file.PathScanner) error

Scan a path for changes (compared to latest manifest) and upload the diff.

func WriteManifest

func WriteManifest(filename string, scanner *file.PathScanner) (err error)

Write a manifest file from some path scan.

Types

type Manifest

type Manifest struct {
	Version int              `json:"version"`
	LastSet string           `json:"lastSet"`
	Created time.Time        `json:"created"`
	Updated time.Time        `json:"updated"`
	Entries []*ManifestEntry `json:"entries"`
	// contains filtered or unexported fields
}

func NewManifest

func NewManifest(files []file.File) Manifest

func ReadManifestData

func ReadManifestData(data []byte) (m Manifest, err error)

func (*Manifest) Compare

func (before *Manifest) Compare(after []file.File) []file.File

func (*Manifest) Has

func (m *Manifest) Has(f file.File) bool

func (*Manifest) HasIdentical

func (m *Manifest) HasIdentical(their file.File) bool

func (*Manifest) JSON

func (m *Manifest) JSON() ([]byte, error)

func (*Manifest) LatestEntries

func (m *Manifest) LatestEntries() map[string][]*ManifestEntry

func (*Manifest) MarshalJSON

func (m *Manifest) MarshalJSON() ([]byte, error)

func (*Manifest) Remove

func (m *Manifest) Remove(f file.File) bool

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(data []byte) (err error)

func (*Manifest) Update

func (m *Manifest) Update(files []file.File) time.Time

type ManifestEntry

type ManifestEntry struct {
	file.File
	Set   string
	Parts []ManifestEntryPart
}

func (*ManifestEntry) MarshalJSON

func (f *ManifestEntry) MarshalJSON() ([]byte, error)

func (*ManifestEntry) UnmarshalJSON

func (f *ManifestEntry) UnmarshalJSON(data []byte) (err error)

type ManifestEntryPart

type ManifestEntryPart struct {
	Key   string          `json:"key"`
	Range store.ByteRange `json:"range"`
}

func (*ManifestEntryPart) MarshalJSON

func (p *ManifestEntryPart) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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