-
Notifications
You must be signed in to change notification settings - Fork 649
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
Add Inspect
method & command to inspect db structure
#674
Conversation
7f850e7
to
a3c8bfa
Compare
Also added a related command: bbolt inspect db The outputed etcd data structure: { "name": "root", "keyN": 0, "children": [ { "name": "alarm", "keyN": 0 }, { "name": "auth", "keyN": 2 }, { "name": "authRoles", "keyN": 1 }, { "name": "authUsers", "keyN": 1 }, { "name": "cluster", "keyN": 1 }, { "name": "key", "keyN": 1285 }, { "name": "lease", "keyN": 2 }, { "name": "members", "keyN": 1 }, { "name": "members_removed", "keyN": 0 }, { "name": "meta", "keyN": 3 } ] } Signed-off-by: Benjamin Wang <[email protected]>
a3c8bfa
to
019c34e
Compare
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
@@ -170,6 +170,7 @@ The commands are: | |||
pages print list of pages with their types | |||
page-item print the key and value of a page item. | |||
stats iterate over all pages and generate usage stats | |||
inspect inspect the structure of the database |
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.
Just curious: was there a reason not to add this to the Run
method as well?
Currently it seems the inspect
command does not work, but the code is there thanks to this commit. trying to understand if that's intentional
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.
When the commands are not found in the Run method, bbolt will automatically try to run the cobra commands,
Lines 68 to 69 in 92c7414
} else if err == ErrUnknownCommand { | |
cobraExecute() |
Currently it seems the
inspect
command does not work
Have you tried it out? This isn't the first time I see this false statement. Please try it out, let me know whether you really have issue.
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.
Using 1.3.11
I get:
$ bbolt inspect /tmp/meta.db
unknown command
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.
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.
New features, including this one, only go into main
branch.
So please try the main branch or v1.4.0-beta.0
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.
Example 1: inspect etcd db file
Example 2: inspect the db file generated in test case
TestBucket_Inspect