client/status: notify user if size estimation is imprecise

There's plenty of room for improvement here.
For example, detect if we're past the last step without size estimation
and compute the remaining sum of bytes to be replicated from there on.
This commit is contained in:
Christian Schwarz
2020-01-01 15:45:55 +01:00
parent f8200a6386
commit 9a4763ceee
2 changed files with 22 additions and 7 deletions
+6 -4
View File
@@ -91,19 +91,21 @@ type StepInfo struct {
BytesReplicated int64
}
func (a *AttemptReport) BytesSum() (expected, replicated int64) {
func (a *AttemptReport) BytesSum() (expected, replicated int64, containsInvalidSizeEstimates bool) {
for _, fs := range a.Filesystems {
e, r := fs.BytesSum()
e, r, fsContainsInvalidEstimate := fs.BytesSum()
containsInvalidSizeEstimates = containsInvalidSizeEstimates || fsContainsInvalidEstimate
expected += e
replicated += r
}
return expected, replicated
return expected, replicated, containsInvalidSizeEstimates
}
func (f *FilesystemReport) BytesSum() (expected, replicated int64) {
func (f *FilesystemReport) BytesSum() (expected, replicated int64, containsInvalidSizeEstimates bool) {
for _, step := range f.Steps {
expected += step.Info.BytesExpected
replicated += step.Info.BytesReplicated
containsInvalidSizeEstimates = containsInvalidSizeEstimates || step.Info.BytesExpected == 0
}
return
}