Start work on porting receive code to Go

This commit is contained in:
Kovid Goyal
2023-07-21 16:48:21 +05:30
parent bf9b139960
commit 732cbcea86
5 changed files with 59 additions and 140 deletions

View File

@@ -12,6 +12,7 @@ import (
"kitty/tools/crypto"
"kitty/tools/utils"
"kitty/tools/utils/humanize"
)
var _ = fmt.Print
@@ -104,3 +105,10 @@ func should_be_compressed(path, strategy string) bool {
}
return true
}
func print_rsync_stats(total_bytes, delta_bytes, signature_bytes int64) {
fmt.Println("Rsync stats:")
fmt.Printf(" Delta size: %s Signature size: %s\n", humanize.Size(delta_bytes), humanize.Size(signature_bytes))
frac := float64(delta_bytes+signature_bytes) / float64(utils.Max(1, total_bytes))
fmt.Printf(" Transmitted: %s of a total of %s (%.1f%%)\n", humanize.Size(delta_bytes+signature_bytes), humanize.Size(total_bytes), frac*100)
}