mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 13:55:20 +00:00
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
"github.com/vmware-tanzu/velero/pkg/uploader"
|
||||
|
||||
"github.com/kopia/kopia/snapshot/snapshotfs"
|
||||
"github.com/kopia/kopia/snapshot/upload"
|
||||
)
|
||||
|
||||
// Throttle throttles controlle the interval of output result
|
||||
@@ -63,7 +63,7 @@ type Progress struct {
|
||||
outputThrottle Throttle // which control the frequency of update progress
|
||||
updater uploader.ProgressUpdater //which kopia progress will call the UpdateProgress interface, the third party will implement the interface to do the progress update
|
||||
log logrus.FieldLogger // output info into log when backup
|
||||
estimationParam snapshotfs.EstimationParameters
|
||||
estimationParam upload.EstimationParameters
|
||||
}
|
||||
|
||||
func NewProgress(updater uploader.ProgressUpdater, interval time.Duration, log logrus.FieldLogger) *Progress {
|
||||
@@ -73,8 +73,8 @@ func NewProgress(updater uploader.ProgressUpdater, interval time.Duration, log l
|
||||
interval: interval,
|
||||
},
|
||||
updater: updater,
|
||||
estimationParam: snapshotfs.EstimationParameters{
|
||||
Type: snapshotfs.EstimationTypeClassic,
|
||||
estimationParam: upload.EstimationParameters{
|
||||
Type: upload.EstimationTypeClassic,
|
||||
AdaptiveThreshold: 300000,
|
||||
},
|
||||
log: log,
|
||||
@@ -169,7 +169,7 @@ func (p *Progress) ProgressBytes(processedBytes int64, totalBytes int64) {
|
||||
|
||||
func (p *Progress) FinishedFile(fname string, err error) {}
|
||||
|
||||
func (p *Progress) EstimationParameters() snapshotfs.EstimationParameters {
|
||||
func (p *Progress) EstimationParameters() upload.EstimationParameters {
|
||||
return p.estimationParam
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/kopia/kopia/snapshot/snapshotfs"
|
||||
"github.com/kopia/kopia/snapshot/upload"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
@@ -85,7 +85,7 @@ func NewKopiaUploaderProvider(
|
||||
}
|
||||
|
||||
// CheckContext check context status check if context is timeout or cancel and backup restore once finished it will quit and return
|
||||
func (kp *kopiaProvider) CheckContext(ctx context.Context, finishChan chan struct{}, restoreChan chan struct{}, uploader *snapshotfs.Uploader) {
|
||||
func (kp *kopiaProvider) CheckContext(ctx context.Context, finishChan chan struct{}, restoreChan chan struct{}, uploader *upload.Uploader) {
|
||||
select {
|
||||
case <-finishChan:
|
||||
kp.log.Infof("Action finished")
|
||||
@@ -135,7 +135,7 @@ func (kp *kopiaProvider) RunBackup(
|
||||
"parentSnapshot": parentSnapshot,
|
||||
})
|
||||
repoWriter := kopia.NewShimRepo(kp.bkRepo)
|
||||
kpUploader := snapshotfs.NewUploader(repoWriter)
|
||||
kpUploader := upload.NewUploader(repoWriter)
|
||||
kpUploader.Progress = kopia.NewProgress(updater, backupProgressCheckInterval, log)
|
||||
kpUploader.FailFast = true
|
||||
quit := make(chan struct{})
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/kopia/kopia/repo"
|
||||
"github.com/kopia/kopia/snapshot/snapshotfs"
|
||||
"github.com/kopia/kopia/snapshot/upload"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -172,7 +172,7 @@ func TestCheckContext(t *testing.T) {
|
||||
name string
|
||||
finishChan chan struct{}
|
||||
restoreChan chan struct{}
|
||||
uploader *snapshotfs.Uploader
|
||||
uploader *upload.Uploader
|
||||
expectCancel bool
|
||||
expectBackup bool
|
||||
expectRestore bool
|
||||
@@ -181,7 +181,7 @@ func TestCheckContext(t *testing.T) {
|
||||
name: "FinishChan",
|
||||
finishChan: make(chan struct{}),
|
||||
restoreChan: make(chan struct{}),
|
||||
uploader: &snapshotfs.Uploader{},
|
||||
uploader: &upload.Uploader{},
|
||||
expectCancel: false,
|
||||
expectBackup: false,
|
||||
expectRestore: false,
|
||||
|
||||
Reference in New Issue
Block a user