A database file currently is not readable.
To manually inspect the contents of such a file, we want to have a tool to use, which displays information about the file.
The developer should figure out, which properties are most important. He should also figure out, which sub-commands to the inspect command would make sense to have.
xdb inspect will be a tool that can inspect the database file (.xdb)
This can be started by xdb inspect dbFile.xdb, which should start an interactive CLI that enables a multitude of explorations of the database file. This tools is however only a read only tool that can only read about what the database file has. No modification operations are permitted for the sake of safety and simplicity.
General requirements of the tool:
- The tool must be able to read a DB file and provide the details available via the file in a human friendly format.
- The CLI is interactive for some commands which enables the CLI to be stateful. Find in depth explanation with specific commands that support this.
- The commands that are supported will be in the scope of the data available in the DB file and the supporting engine implementation and will be explained in further requirements.
- Auto-completion - auto completion for table names on
Tab (or as supported by the CLI library).
- Command - Help: Gives a basic explanation on how to use the CLI and on specific commands too.
- Command - Overview: Gives a basic idea of the entire file; data on how much space is used, how many tables exist etc - detail in ticket.
- Command - page: Usage -
page numberOfPage. Gives cell level data on the page, detail in ticket.
- Command - table: Usage -
table TableName. Display table data as provided by engine.
Package location:
The inspector should reside in cmd/xdb/inspect.go as a new cobra command.
The actual inspector implementation should reside in internal/inspector. We can think about moving it to public API if developers request that, however, right now that would only increase the development efforts that have to be taken.
Sample intended output:
$ xdb inspect file.db
Summary of file.db (size 256KiB)
Pages: 4
Tables: 1
Unused: 255KiB
$ xdb inspect tables file.db
Summary of tables in file.db
Tables: 1
Summary of 'myTable'
Schema:
CREATE TABLE myTable (
id CHAR,
created DATE
)
Records: 1
and many more.
Commands supported:
Supporting issues:
A database file currently is not readable.
To manually inspect the contents of such a file, we want to have a tool to use, which displays information about the file.
The developer should figure out, which properties are most important. He should also figure out, which sub-commands to the
inspectcommand would make sense to have.xdb inspectwill be a tool that can inspect the database file (.xdb)This can be started by
xdb inspect dbFile.xdb, which should start an interactive CLI that enables a multitude of explorations of the database file. This tools is however only a read only tool that can only read about what the database file has. No modification operations are permitted for the sake of safety and simplicity.General requirements of the tool:
Tab(or as supported by the CLI library).page numberOfPage. Gives cell level data on the page, detail in ticket.table TableName. Display table data as provided by engine.Package location:
The inspector should reside in
cmd/xdb/inspect.goas a new cobra command.The actual inspector implementation should reside in
internal/inspector. We can think about moving it to public API if developers request that, however, right now that would only increase the development efforts that have to be taken.Sample intended output:
and many more.
Commands supported:
help- gives out details about what the Inspector can do.overview- displays the space occupied, the number of tables and other details about the db.table TableName- reads the table details.page pageID- outputs all the captured details of the page in details.Supporting issues: