diff --git a/.changelog/9098.txt b/.changelog/9098.txt index 7eab76834..2963aa754 100644 --- a/.changelog/9098.txt +++ b/.changelog/9098.txt @@ -1,3 +1,3 @@ ```release-note:feature -cli: snapshot inspect command provides KV space usage breakdown +cli: snapshot inspect command provides KV usage breakdown ``` diff --git a/command/snapshot/inspect/snapshot_inspect.go b/command/snapshot/inspect/snapshot_inspect.go index ff4b8f059..e0bbd648c 100644 --- a/command/snapshot/inspect/snapshot_inspect.go +++ b/command/snapshot/inspect/snapshot_inspect.go @@ -172,8 +172,8 @@ type typeStats struct { Count int } -// Generate the stats for the output struct that's -// used to produce the printed output the user sees. +// generateStats formats the stats for the output struct +// that's used to produce the printed output the user sees. func generateStats(info SnapshotInfo) []typeStats { ss := make([]typeStats, 0, len(info.Stats)) @@ -186,8 +186,9 @@ func generateStats(info SnapshotInfo) []typeStats { return ss } -// Generate the KV stats for the output struct that's -// used to produce the printed output the user sees. +// generateKVStats reformats the KV stats to work with +// the output struct that's used to produce the printed +// output the user sees. func generateKVStats(info SnapshotInfo) []typeStats { kvLen := len(info.StatsKV) if kvLen > 0 { @@ -205,7 +206,8 @@ func generateKVStats(info SnapshotInfo) []typeStats { return nil } -// Sort the stat slice +// sortTypeStats sorts the stat slice by size and then +// alphabetically in the case the size is identical func sortTypeStats(stats []typeStats) []typeStats { sort.Slice(stats, func(i, j int) bool { // sort alphabetically if size is equal