Documentation ¶
Index ¶
- Constants
- func BackupCommandByID(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, pathToBackup string) string
- func BackupCommandByTag(...) string
- func DoesRepoExist(output string) bool
- func ForgetCommandByTag(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, tag string) string
- func GeneratePassword() string
- func InitCommand(s3Endpoint, ak, sk, repository, encryptionKey, clusterID string) string
- func IsPasswordIncorrect(output string) bool
- func LatestSnapshotsCommand(s3Endpoint, ak, sk, repository, encryptionKey, clusterID string) string
- func ParseResticSizeStringBytes(sizeStr string) int64
- func PruneCommand(s3Endpoint, ak, sk, repository, encryptionKey, clusterID string) string
- func RestoreCommandByID(...) string
- func RestoreCommandByTag(...) string
- func SnapshotIDFromBackupLog(output string) string
- func SnapshotIDFromSnapshotLog(output string) ([]string, error)
- func SnapshotStatsFromBackupLog(output string) (fileCount string, backupSize string, phySize string)
- func SnapshotsCommand(s3Endpoint, ak, sk, repository, encryptionKey, clusterID string) string
- func SnapshotsCommandByTag(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, tag string) string
- func SpaceFreedFromPruneLog(output string) string
- type Output
- type ResticClient
- func (r *ResticClient) BackupData(repository, pathToBackup, backupTag string, updateEventFunc func(float64)) (int64, error)
- func (r *ResticClient) CheckIfRepoIsReachable(repository string) error
- func (r *ResticClient) CheckSnapshotExist(repository string) (bool, error)
- func (r *ResticClient) DeleteDataByTag(repository string, deleteTag string, reclaimSpace bool) (map[string]interface{}, error)
- func (r *ResticClient) GetOrCreateRepository(repository string) error
- func (r *ResticClient) PruneData(repository string) (string, error)
- func (r *ResticClient) RestoreData(repository, pathToRestore, backupTag string) (map[string]interface{}, error)
Constants ¶
const ( AWSAccessKeyID = "AWS_ACCESS_KEY_ID" AWSSecretAccessKey = "AWS_SECRET_ACCESS_KEY" ResticPassword = "RESTIC_PASSWORD" ResticRepository = "RESTIC_REPOSITORY" ResticCommand = "restic" // DeleteDataOutputSpaceFreed is the key for the output reporting the space freed DeleteDataOutputSpaceFreed = "spaceFreed" PasswordIncorrect = "password is incorrect" RepoDoesNotExist = "repo does not exist" RepoBucket = "open-local" )
const (
PhaseOpString = "###Phase-output###:"
)
Variables ¶
This section is empty.
Functions ¶
func BackupCommandByID ¶
func BackupCommandByID(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, pathToBackup string) string
BackupCommandByID returns restic backup command
func BackupCommandByTag ¶
func BackupCommandByTag(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, backupTag, includePath string) string
BackupCommandByTag returns restic backup command with tag
func DoesRepoExist ¶
DoesRepoExists checks if repo exists from Snapshot Command log
func ForgetCommandByTag ¶
func ForgetCommandByTag(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, tag string) string
ForgetCommandByTag returns restic forget command
func InitCommand ¶
func IsPasswordIncorrect ¶
IsPasswordIncorrect checks if password was wrong from Snapshot Command log
func LatestSnapshotsCommand ¶
func ParseResticSizeStringBytes ¶
ParseResticSizeStringBytes parses size strings as formatted by restic to a int64 number of bytes
func PruneCommand ¶
PruneCommand returns restic prune command
func RestoreCommandByID ¶
func RestoreCommandByID(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, id, restorePath string) string
RestoreCommandByID returns restic restore command with snapshotID as the identifier
func RestoreCommandByTag ¶
func RestoreCommandByTag(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, tag, restorePath string) string
RestoreCommandByTag returns restic restore command with tag as the identifier
func SnapshotIDFromBackupLog ¶
SnapshotIDFromBackupLog gets the SnapshotID from Backup Command log
func SnapshotIDFromSnapshotLog ¶
SnapshotIDFromSnapshotLog gets the SnapshotID from Snapshot Command log
func SnapshotStatsFromBackupLog ¶
func SnapshotStatsFromBackupLog(output string) (fileCount string, backupSize string, phySize string)
SnapshotStatsFromBackupLog gets the Snapshot file count and size from Backup Command log
func SnapshotsCommand ¶
SnapshotsCommand returns restic snapshots command
func SnapshotsCommandByTag ¶
func SnapshotsCommandByTag(s3Endpoint, ak, sk, repository, encryptionKey, clusterID, tag string) string
SnapshotsCommandByTag returns restic snapshots command
func SpaceFreedFromPruneLog ¶
SpaceFreedFromPruneLog gets the space freed from the prune log output For reference, here is the logging command from restic codebase:
Verbosef("will delete %d packs and rewrite %d packs, this frees %s\n", len(removePacks), len(rewritePacks), formatBytes(uint64(removeBytes)))
Types ¶
type Output ¶
func UnmarshalOutput ¶
UnmarshalOutput unmarshals output json into Output struct
type ResticClient ¶
type ResticClient struct {
// contains filtered or unexported fields
}
func NewResticClient ¶
func NewResticClient(s3Endpoint, ak, sk, encryptionKey string, kubeclient kubernetes.Interface) (*ResticClient, error)
申请 restic client 要求必须传入 repository
func (*ResticClient) BackupData ¶
func (r *ResticClient) BackupData(repository, pathToBackup, backupTag string, updateEventFunc func(float64)) (int64, error)
func (*ResticClient) CheckIfRepoIsReachable ¶
func (r *ResticClient) CheckIfRepoIsReachable(repository string) error
CheckIfRepoIsReachable checks if repo can be reached by trying to list snapshots
func (*ResticClient) CheckSnapshotExist ¶
func (r *ResticClient) CheckSnapshotExist(repository string) (bool, error)
func (*ResticClient) DeleteDataByTag ¶
func (*ResticClient) GetOrCreateRepository ¶
func (r *ResticClient) GetOrCreateRepository(repository string) error
GetOrCreateRepository will check if the repository already exists and initialize one if not
func (*ResticClient) PruneData ¶
func (r *ResticClient) PruneData(repository string) (string, error)
func (*ResticClient) RestoreData ¶
func (r *ResticClient) RestoreData(repository, pathToRestore, backupTag string) (map[string]interface{}, error)