-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bbolt page supports --all and --value-format=redacted formats. #359
Conversation
Signed-off-by: Piotr Tabor <ptab@google.com>
7cf0ecd
to
bdf7b8f
Compare
The first commit is just extraction of the command to a file (the main.go is already huge), |
This commit has not-mechanical changes: bdf7b8f |
cmd/bbolt/page_command.go
Outdated
--all | ||
prints all pages (only skips pages that were considered successful overflow pages) | ||
--value-format=`+FORMAT_MODES+` (default: auto) | ||
just prints a length of the value, to reduce length and protect privacy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that --value-format
is only used to format the leaf page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as on other pages we have usually 'keys'.
It makes sense - especially in etcd case to keep keys as hex.
Expanded the comment (it was clearly wrong).
func (p *page) Type() string { | ||
if (p.flags & branchPageFlag) != 0 { | ||
// For now all flags are exclusive,so let's be strict with expectations. | ||
if p.flags == branchPageFlag { | ||
return "branch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking why not to define const? We can get all const defined in a common package, so as to be shared by both boltDB and CMDs. Of course, in a separate PR.
type PageType string
const (
BranchPage PageType = "branch"
...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. The extraction of shared library starts here: #361
Overall looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with only a minor comment #359 (comment). The description for --value-format
isn't clear to me. I'd leave you to update the usage.
--all - prints all pages (only skips pages that were considered successful overflow pages) --value-format=redacted just prints a length of the value, to reduce length and protect privacy. The auto & redacted formats are supported in all tools that accept '--format'. Signed-off-by: Piotr Tabor <ptab@google.com>
bdf7b8f
to
577a4d9
Compare
Thank you for review. |
bbolt page supports --all and --value-format=redacted formats.
The auto & redacted formats are supported in all tools that accept '--format'.