-
Notifications
You must be signed in to change notification settings - Fork 556
tool: add value pretty-printing facility #630
Copy link
Copy link
Closed
Description
Keys can be pretty-printed using the Comparer.Format facility. We should add something similar for values. This is particularly useful for CRDB post-mortem debugging where values have rich structure. For CRDB, decoding of the value is dependent on the key, so the interface here will need to take both a key and value. Something like:
type PrettyValue func(key, value []byte) fmt.Formatter
For CRDB this would look something like:
PrettyValue = func(key, value []byte) string {
decoded, err := storage.DecodeMVCCKey(key)
if err != nil {
return err.Error()
}
return kvserver.SprintKeyValue(storage.MVCCKeyValue{Key: decoded, Value: value}, false)
}
Open question is how to associate this PrettyValue function with the comparer. Should RegisterComparer take an optional PrettyValue?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels