Skip to content

Commit

Permalink
tool: print sstable format in properties
Browse files Browse the repository at this point in the history
Currently, there's no pebble command-line tool that prints an
sstable's format. This change prints the sstable's format in
the sstable properties command.
  • Loading branch information
itsbilal committed Nov 5, 2024
1 parent 405b4e1 commit 638ad87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tool/sstable.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ func (s *sstableT) runProperties(cmd *cobra.Command, args []string) {
}

tw := tabwriter.NewWriter(stdout, 2, 1, 2, ' ', 0)
fmt.Fprintf(tw, "format\t")
format, err := r.TableFormat()
if err != nil {
fmt.Fprintf(tw, "error when retrieving format %s\n", err)
} else {
fmt.Fprintf(tw, "%s\n", format.String())
}
fmt.Fprintf(tw, "size\t\n")
fmt.Fprintf(tw, " file\t%s\n", humanize.Bytes.Int64(stat.Size()))
fmt.Fprintf(tw, " data\t%s\n", humanize.Bytes.Uint64(r.Properties.DataSize))
Expand Down
Binary file modified tool/testdata/sstable_properties
Binary file not shown.

0 comments on commit 638ad87

Please sign in to comment.