backupstore

package module
v0.0.0-...-cf505f7 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

backupstore

Documentation

Index

Constants

View Source
const (
	VOLUME_SEPARATE_LAYER1 = 2
	VOLUME_SEPARATE_LAYER2 = 4

	VOLUME_DIRECTORY     = "volumes"
	VOLUME_CONFIG_FILE   = "volume.cfg"
	BACKUP_DIRECTORY     = "backups"
	BACKUP_CONFIG_PREFIX = "backup_"

	CFG_SUFFIX = ".cfg"
)
View Source
const (
	DEFAULT_BLOCK_SIZE = 2097152

	BLOCKS_DIRECTORY      = "blocks"
	BLOCK_SEPARATE_LAYER1 = 2
	BLOCK_SEPARATE_LAYER2 = 4
)
View Source
const (
	BACKUP_FILES_DIRECTORY = "BackupFiles"
)
View Source
const (
	MessageTypeError = MessageType("error")
)

Variables

This section is empty.

Functions

func CreateDeltaBlockBackup

func CreateDeltaBlockBackup(config *DeltaBackupConfig) (string, error)

func CreateSingleFileBackup

func CreateSingleFileBackup(volume *Volume, snapshot *Snapshot, filePath, destURL string) (string, error)

func DeleteDeltaBlockBackup

func DeleteDeltaBlockBackup(backupURL string) error

func DeleteSingleFileBackup

func DeleteSingleFileBackup(backupURL string) error

func GetBackupFromBackupURL

func GetBackupFromBackupURL(backupURL string) (string, error)

func GetBackupstoreBase

func GetBackupstoreBase() string

func GetVolumeFromBackupURL

func GetVolumeFromBackupURL(backupURL string) (string, error)

func List

func List(volumeName, destURL string, volumeOnly bool) (map[string]*VolumeInfo, error)

func RegisterDriver

func RegisterDriver(kind string, initFunc InitFunc) error

func RestoreDeltaBlockBackup

func RestoreDeltaBlockBackup(backupURL, volDevName string) error

func RestoreDeltaBlockBackupIncrementally

func RestoreDeltaBlockBackupIncrementally(backupURL, volDevName, lastBackupName string) error

func RestoreSingleFileBackup

func RestoreSingleFileBackup(backupURL, path string) (string, error)

func SetBackupstoreBase

func SetBackupstoreBase(base string)

Types

type Backup

type Backup struct {
	Name              string
	VolumeName        string
	SnapshotName      string
	SnapshotCreatedAt string
	CreatedTime       string
	Size              int64 `json:",string"`
	Labels            map[string]string

	Blocks     []BlockMapping `json:",omitempty"`
	SingleFile BackupFile     `json:",omitempty"`
}

type BackupFile

type BackupFile struct {
	FilePath string
}

type BackupInfo

type BackupInfo struct {
	Name            string
	URL             string
	SnapshotName    string
	SnapshotCreated string
	Created         string
	Size            int64 `json:",string"`
	Labels          map[string]string

	VolumeName    string `json:",omitempty"`
	VolumeSize    int64  `json:",string,omitempty"`
	VolumeCreated string `json:",omitempty"`
}

func InspectBackup

func InspectBackup(backupURL string) (*BackupInfo, error)

type BackupStoreDriver

type BackupStoreDriver interface {
	Kind() string
	GetURL() string
	FileExists(filePath string) bool
	FileSize(filePath string) int64
	Remove(names ...string) error           // Bahavior like "rm -rf"
	Read(src string) (io.ReadCloser, error) // Caller needs to close
	Write(dst string, rs io.ReadSeeker) error
	List(path string) ([]string, error) // Behavior like "ls", not like "find"
	Upload(src, dst string) error
	Download(src, dst string) error
}

func GetBackupStoreDriver

func GetBackupStoreDriver(destURL string) (BackupStoreDriver, error)

type BlockMapping

type BlockMapping struct {
	Offset        int64
	BlockChecksum string
}

type DeltaBackupConfig

type DeltaBackupConfig struct {
	Volume   *Volume
	Snapshot *Snapshot
	DestURL  string
	DeltaOps DeltaBlockBackupOperations
	Labels   map[string]string
}

type DeltaBlockBackupOperations

type DeltaBlockBackupOperations interface {
	HasSnapshot(id, volumeID string) bool
	CompareSnapshot(id, compareID, volumeID string) (*Mappings, error)
	OpenSnapshot(id, volumeID string) error
	ReadSnapshot(id, volumeID string, start int64, data []byte) error
	CloseSnapshot(id, volumeID string) error
}

type InitFunc

type InitFunc func(destURL string) (BackupStoreDriver, error)

type Mapping

type Mapping struct {
	Offset int64
	Size   int64
}

type Mappings

type Mappings struct {
	Mappings  []Mapping
	BlockSize int64
}

type MessageType

type MessageType string

type Snapshot

type Snapshot struct {
	Name        string
	CreatedTime string
}

type Volume

type Volume struct {
	Name           string
	Size           int64 `json:",string"`
	CreatedTime    string
	LastBackupName string
	LastBackupAt   string
	BlockCount     int64 `json:",string"`
}

func LoadVolume

func LoadVolume(backupURL string) (*Volume, error)

type VolumeInfo

type VolumeInfo struct {
	Name           string
	Size           int64 `json:",string"`
	Created        string
	LastBackupName string
	LastBackupAt   string
	DataStored     int64 `json:",string"`

	Messages map[MessageType]string

	Backups map[string]*BackupInfo `json:",omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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