Skip to content

Commit

Permalink
db: implement fmt.Stringer on BackingType
Browse files Browse the repository at this point in the history
This will be used within Cockroach to implement a custom JSON serialization of
the set of sstables returned by the sstable_metrics builtin.
  • Loading branch information
jbowens committed Aug 12, 2024
1 parent 5e1ab49 commit 57ff76d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -2098,8 +2098,21 @@ const (
// or lifecycle management. An example of an external file is a file restored
// from a backup.
BackingTypeExternal
backingTypeCount
)

var backingTypeToString = [backingTypeCount]string{
BackingTypeLocal: "local",
BackingTypeShared: "shared",
BackingTypeSharedForeign: "shared-foreign",
BackingTypeExternal: "external",
}

// String implements fmt.Stringer.
func (b BackingType) String() string {
return backingTypeToString[b]
}

// SSTableInfo export manifest.TableInfo with sstable.Properties alongside
// other file backing info.
type SSTableInfo struct {
Expand Down

0 comments on commit 57ff76d

Please sign in to comment.