MCPcopy
hub / github.com/kopia/kopia / logBucketSamples

Function logBucketSamples

internal/server/api_estimate.go:60–98  ·  view source on GitHub ↗
(ctx context.Context, buckets upload.SampleBuckets, prefix string, showExamples bool)

Source from the content-addressed store, hash-verified

58}
59
60func logBucketSamples(ctx context.Context, buckets upload.SampleBuckets, prefix string, showExamples bool) {
61 hasAny := false
62
63 for i, bucket := range buckets {
64 if bucket.Count == 0 {
65 continue
66 }
67
68 var sizeRange string
69
70 if i == 0 {
71 sizeRange = fmt.Sprintf("< %-6v",
72 units.BytesString(bucket.MinSize))
73 } else {
74 sizeRange = fmt.Sprintf("%-6v...%6v",
75 units.BytesString(bucket.MinSize),
76 units.BytesString(buckets[i-1].MinSize))
77 }
78
79 userLog(ctx).Infof("%v files %v: %7v files, total size %v\n",
80 prefix,
81 sizeRange,
82 bucket.Count, units.BytesString(bucket.TotalSize))
83
84 hasAny = true
85
86 if showExamples && len(bucket.Examples) > 0 {
87 userLog(ctx).Info("Examples:")
88
89 for _, sample := range bucket.Examples {
90 userLog(ctx).Infof(" - %v\n", sample)
91 }
92 }
93 }
94
95 if !hasAny {
96 userLog(ctx).Infof("%v files: None", prefix)
97 }
98}
99
100var _ upload.EstimateProgress = estimateTaskProgress{}
101

Callers 1

StatsMethod · 0.85

Calls 2

BytesStringFunction · 0.92
InfoMethod · 0.80

Tested by

no test coverage detected