Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

inspect: The xdb file inspection tool #65

Open
2 of 9 tasks
SUMUKHA-PK opened this issue Oct 23, 2020 · 0 comments
Open
2 of 9 tasks

inspect: The xdb file inspection tool #65

SUMUKHA-PK opened this issue Oct 23, 2020 · 0 comments
Assignees
Labels

Comments

@SUMUKHA-PK
Copy link
Member

SUMUKHA-PK commented Oct 23, 2020

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:

  1. The tool must be able to read a DB file and provide the details available via the file in a human friendly format.
  2. The CLI is interactive for some commands which enables the CLI to be stateful. Find in depth explanation with specific commands that support this.
  3. 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.
  4. Auto-completion - auto completion for table names on Tab (or as supported by the CLI library).
  5. Command - Help: Gives a basic explanation on how to use the CLI and on specific commands too.
  6. 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.
  7. Command - page: Usage - page numberOfPage. Gives cell level data on the page, detail in ticket.
  8. 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:

  • 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:

@SUMUKHA-PK SUMUKHA-PK changed the title xdb inspect: The xdb file inspection tool inspect: The xdb file inspection tool Oct 23, 2020
@SUMUKHA-PK SUMUKHA-PK self-assigned this Oct 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant