-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.go
56 lines (51 loc) · 1.58 KB
/
ui.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package fsdd
import (
"time"
)
const (
_unit = "bytes"
_e = "]"
_time = " [time: "
_dat = " [data blocks: "
_inodes = " [inode(s): "
_symlinks = " [symlink(s): "
)
func reportInit() {
hashfunc := " [hash:sha512_trunc_256] "
if c.FastHash {
hashfunc = " [hash:MAPHASH] "
}
out("FSDD [start] [" + c.Path + "] " + c.Opt + hashfunc)
}
func reportSummary(t0 time.Time) {
sinodes -= failinodes
stotal -= failsize
ssym -= failssym
if len(c.Opt) > 5 {
c.Opt = c.Opt[:len(c.Opt)-1]
}
prefix := "FSDD [_info] ["
if !c.HardLink && !c.SymLink && !c.ReplaceSymlinks {
prefix = "FSDD [_info] [possible "
}
ls := len(sym)
li := len(syi)
s := " [sym.valid: " + itoa(ls) + "] [sym.invalid: " + itoa(li) + _e
out("FSDD [_done]" + _time + time.Since(t0).String() + _e)
out("FSDD [stats] [files:" + itoa(len(sfs)) + _e + _inodes + itoa(len(xfs)+ls+li) + _e + s + _dat + hruIEC(total, _unit) + _e)
if hcount+hsave > 0 {
out("FSDD [_info] [deduplication savings]" + _inodes + itoaU64(hcount) + _e + _dat + hruIEC(hsave, _unit) + _e)
}
if sinodes+stotal+ssym+uint64(ls) > 0 {
out(prefix + "new deduplication savings]" + _inodes + itoaU64(sinodes+uint64(len(sym))) + _e + nsyml(c) + _dat + hruIEC(stotal, _unit) + _e)
}
if failinodes+failsize+failssym > 0 {
out("FSDD [_fail] failed to save" + _inodes + itoaU64(failinodes) + itoaU64(failssym) + _symlinks + _dat + hruIEC(failsize, _unit) + _e)
}
}
func nsyml(c *Config) string {
if !c.HardLink || !c.SymLink || !c.ReplaceSymlinks {
return _symlinks + itoa(len(sym)) + _e
}
return _symlinks + itoaU64(ssym) + _e
}