Documentation
¶
Index ¶
- Constants
- func CleanUpAllMounts() (err error)
- func CreateDeltaBlockBackup(backupName string, config *DeltaBackupConfig) (isIncremental bool, err error)
- func CreateSingleFileBackup(volume *Volume, snapshot *Snapshot, filePath, destURL string) (string, error)
- func DecodeBackupURL(backupURL string) (string, string, string, error)
- func DecompressAndVerifyWithFallback(bsDriver BackupStoreDriver, blkFile, decompression, checksum string) (io.Reader, error)
- func DeleteBackupVolume(volumeName string, destURL string) error
- func DeleteDeltaBlockBackup(backupURL string) error
- func DeleteSingleFileBackup(backupURL string) error
- func EncodeBackupURL(backupName, volumeName, destURL string) string
- func GetBackupstoreBase() string
- func GetLog() logrus.FieldLogger
- func List(volumeName, destURL string, volumeOnly bool) (map[string]*VolumeInfo, error)
- func LoadConfigInBackupStore(driver BackupStoreDriver, filePath string, v interface{}) error
- func RegisterDriver(kind string, initFunc InitFunc) error
- func RestoreDeltaBlockBackup(ctx context.Context, config *DeltaRestoreConfig) error
- func RestoreDeltaBlockBackupIncrementally(ctx context.Context, config *DeltaRestoreConfig) error
- func RestoreSingleFileBackup(backupURL, path string) (string, error)
- func SaveBackupStoreToLocalFile(driver BackupStoreDriver, backupStoreFileURL, localFilePath string) error
- func SaveConfigInBackupStore(driver BackupStoreDriver, filePath string, v interface{}) error
- func SaveLocalFileToBackupStore(localFilePath, backupStoreFilePath string, driver BackupStoreDriver) error
- func SetBackupstoreBase(base string)
- type Backup
- type BackupFile
- type BackupInfo
- type BackupStoreDriver
- type Block
- type BlockInfo
- type BlockMapping
- type ConfigMetadata
- type DataEngine
- type DeltaBackupConfig
- type DeltaBlockBackupOperations
- type DeltaRestoreConfig
- type DeltaRestoreOperations
- type FileLock
- type InitFunc
- type LockType
- type Operation
- type ProcessingBlocks
- type Snapshot
- type Volume
- type VolumeInfo
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 ( LOCKS_DIRECTORY = "locks" LOCK_PREFIX = "lock" LOCK_SUFFIX = ".lck" LOCK_DURATION = time.Second * 150 LOCK_REFRESH_INTERVAL = time.Second * 60 LOCK_CHECK_WAIT_TIME = time.Second * 2 )
View Source
const ( DEFAULT_BLOCK_SIZE = 2 * 1024 * 1024 LEGACY_COMPRESSION_METHOD = "gzip" BLOCKS_DIRECTORY = "blocks" BLOCK_SEPARATE_LAYER1 = 2 BLOCK_SEPARATE_LAYER2 = 4 BLK_SUFFIX = ".blk" PROGRESS_PERCENTAGE_BACKUP_SNAPSHOT = 95 PROGRESS_PERCENTAGE_BACKUP_TOTAL = 100 )
View Source
const ( DataEngineV1 = DataEngine("v1") DataEngineV2 = DataEngine("v2") )
View Source
const (
BACKUP_FILES_DIRECTORY = "BackupFiles"
)
Variables ¶
This section is empty.
Functions ¶
func CleanUpAllMounts ¶
func CleanUpAllMounts() (err error)
func CreateDeltaBlockBackup ¶
func CreateDeltaBlockBackup(backupName string, config *DeltaBackupConfig) (isIncremental bool, err error)
CreateDeltaBlockBackup creates a delta block backup for the given volume and snapshot.
func CreateSingleFileBackup ¶
func DecompressAndVerifyWithFallback ¶
func DecompressAndVerifyWithFallback(bsDriver BackupStoreDriver, blkFile, decompression, checksum string) (io.Reader, error)
DecompressAndVerifyWithFallback decompresses the given data and verifies the data integrity. If the decompression fails, it will try to decompress with the fallback method.
func DeleteBackupVolume ¶
func DeleteDeltaBlockBackup ¶
func DeleteSingleFileBackup ¶
func EncodeBackupURL ¶
func GetBackupstoreBase ¶
func GetBackupstoreBase() string
func GetLog ¶
func GetLog() logrus.FieldLogger
func LoadConfigInBackupStore ¶
func LoadConfigInBackupStore(driver BackupStoreDriver, filePath string, v interface{}) error
func RegisterDriver ¶
func RestoreDeltaBlockBackup ¶
func RestoreDeltaBlockBackup(ctx context.Context, config *DeltaRestoreConfig) error
RestoreDeltaBlockBackup restores a delta block backup for the given configuration
func RestoreDeltaBlockBackupIncrementally ¶
func RestoreDeltaBlockBackupIncrementally(ctx context.Context, config *DeltaRestoreConfig) error
func RestoreSingleFileBackup ¶
func SaveBackupStoreToLocalFile ¶
func SaveBackupStoreToLocalFile(driver BackupStoreDriver, backupStoreFileURL, localFilePath string) error
func SaveConfigInBackupStore ¶
func SaveConfigInBackupStore(driver BackupStoreDriver, filePath string, v interface{}) error
func SaveLocalFileToBackupStore ¶
func SaveLocalFileToBackupStore(localFilePath, backupStoreFilePath string, driver BackupStoreDriver) error
func SetBackupstoreBase ¶
func SetBackupstoreBase(base string)
Types ¶
type Backup ¶
type Backup struct { sync.Mutex Name string VolumeName string SnapshotName string SnapshotCreatedAt string CreatedTime string Size int64 `json:",string"` Labels map[string]string Parameters map[string]string IsIncremental bool CompressionMethod string NewlyUploadedDataSize int64 `json:",string"` ReUploadedDataSize int64 `json:",string"` ProcessingBlocks *ProcessingBlocks 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 Parameters map[string]string IsIncremental bool CompressionMethod string `json:",omitempty"` NewlyUploadedDataSize int64 `json:",string"` ReUploadedDataSize int64 `json:",string"` VolumeName string `json:",omitempty"` VolumeSize int64 `json:",string,omitempty"` VolumeCreated string `json:",omitempty"` VolumeBackingImageName string `json:",omitempty"` Messages map[types.MessageType]string }
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 FileTime(filePath string) time.Time // Needs to be returned in UTC Remove(path string) error // Behavior 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 ConfigMetadata ¶
func GetConfigMetadata ¶
func GetConfigMetadata(url string) (*ConfigMetadata, error)
type DataEngine ¶
type DataEngine string
type DeltaBackupConfig ¶
type DeltaBlockBackupOperations ¶
type DeltaBlockBackupOperations interface { HasSnapshot(id, volumeID string) bool CompareSnapshot(id, compareID, volumeID string) (*types.Mappings, error) OpenSnapshot(id, volumeID string) error ReadSnapshot(id, volumeID string, start int64, data []byte) error CloseSnapshot(id, volumeID string) error UpdateBackupStatus(id, volumeID string, backupState string, backupProgress int, backupURL string, err string) error }
type DeltaRestoreConfig ¶
type DeltaRestoreConfig struct { BackupURL string DeltaOps DeltaRestoreOperations LastBackupName string Filename string ConcurrentLimit int32 }
type DeltaRestoreOperations ¶
type FileLock ¶
type FileLock struct { Name string Type LockType Acquired bool // contains filtered or unexported fields }
type InitFunc ¶
type InitFunc func(destURL string) (BackupStoreDriver, error)
type LockType ¶
type LockType int
const BACKUP_LOCK LockType = 1
const DELETION_LOCK LockType = 2
const RESTORE_LOCK LockType = 1
const UNTYPED_LOCK LockType = 0
type Operation ¶
type Operation string
const BackupOperationCreateRestore Operation = "create/restore"
const BackupOperationDelete Operation = "delete"
const BackupOperationUndefined Operation = "undefined"
type ProcessingBlocks ¶
type Volume ¶
type Volume struct { Name string Size int64 `json:",string"` Labels map[string]string CreatedTime string LastBackupName string LastBackupAt string BlockCount int64 `json:",string"` BackingImageName string `json:",string"` BackingImageChecksum string `json:",string"` CompressionMethod string `json:",string"` StorageClassName string `json:",string"` DataEngine string `json:",string"` }
func LoadVolume ¶
type VolumeInfo ¶
type VolumeInfo struct { Name string Size int64 `json:",string"` Labels map[string]string Created string LastBackupName string LastBackupAt string DataStored int64 `json:",string"` Messages map[types.MessageType]string Backups map[string]*BackupInfo `json:",omitempty"` BackingImageName string BackingImageChecksum string StorageClassname string DataEngine string }
func InspectVolume ¶
func InspectVolume(volumeURL string) (*VolumeInfo, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.