Skip to content
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

Documentation - developer and helper functionality documentation for xtdb-cli tool #3023

Merged
merged 9 commits into from
Jun 12, 2024

Conversation

stephanie0x00
Copy link
Contributor

@stephanie0x00 stephanie0x00 commented Jun 4, 2024

Changes

This PR adds :

  • the help texts to the XTDB cli tool for all commands and optional arguments and a general description for the tool itself. Most of the CLI tool texts were copied and adjusted where necessary based on the XTDB HTTP documentation (https://v1-docs.xtdb.com/clients/1.24.3/http/)

  • the documentation on how to use the xtdb-cli tool to https://docs.openkat.nl/. It includes a notification that OpenKAT doesn't use vanilla xtdb and provides some examples on how to use the xtdb-cli tool.

Issue link

This PR closes: #2877

Demo

$ ./xtdb-cli.py --help
Usage: xtdb-cli.py [OPTIONS] COMMAND [ARGS]...

  This help functionality explains how to query XTDB using the xtdb-cli tool. The help functionality for all default
  XTDB commands was copied from the official XTDB docs for the HTTP implementation. Not all optional parameters as
  available on the HTTP docs may be implemented.

Options:
  -n, --node TEXT        XTDB node  [default: 0]
  -u, --url TEXT         XTDB server base url  [default: http://localhost:3000]
  -t, --timeout INTEGER  XTDB request timeout (in ms)  [default: 5000]
  -v, --verbosity        Increase the verbosity level  [default: 0]
  -h, --help             Show this message and exit.

Commands:
  active-queries       Returns a list of currently running queries.
  attribute-stats      Returns frequencies of indexed attributes
  await-tx             Waits until the node has indexed a transaction that is at or past the supplied tx-id.
  await-tx-time        Blocks until the node has indexed a transaction that is past the supplied tx-time.
  entity               Returns the document map for a particular entity.
  entity-tx            Returns the transaction details for an entity - returns a map containing the tx-id and...
  history              Returns the history of a particular entity.
  latest-completed-tx  Returns the latest transaction to have been indexed by this node.
  latest-submitted-tx  Returns the latest transaction to have been submitted to this cluster.
  list-keys            List all keys in node
  list-values          List all values in node
  query                EDN Query (default: "{:query {:find [ ?var ] :where [[?var :xt/id ]]}}")
  recent-queries       Returns a list of recently completed/failed queries.
  slowest-queries      Returns a list of slowest completed/failed queries ran on the node.
  status               Returns the current status information of the node
  submit-tx            Takes a vector of transactions (any combination of put, delete, match, evict and fn) and...
  sync                 Wait until the consumer’s lag is back to 0 (i.e.
  tx-committed         Checks if a submitted tx was successfully committed, returning a map with tx-committed and...
  tx-log               Returns a list of all transactions, from oldest to newest transaction time - optionally...
  txs                  Show all document transactions

And now also with the helper text for the optional arguments:

$ ./xtdb-cli.py history --help
Usage: xtdb-cli.py history [OPTIONS] KEY

  Returns the history of a particular entity.

Options:
  --with-docs         Includes the documents in the response sequence, under the doc key (boolean, default: false)
  --with-corrections  Includes bitemporal corrections in the response, inline, sorted by valid-time then tx-id
                      (boolean, default: false)
  -h, --help          Show this message and exit.

Code Checklist

  • All the commits in this PR are properly PGP-signed and verified.
  • This PR only contains functionality relevant to the issue; tickets have been created for newly discovered issues.
  • I have written unit tests for the changes or fixes I made.
  • For any non-trivial functionality, I have added integration and/or end-to-end tests.
  • I have performed a self-review of my code and refactored it to the best of my abilities.

Communication

  • I have informed others of any required .env changes files if required and changed the .env-dist accordingly.
  • I have made corresponding changes to the documentation, if necessary.
  • I have included comments in the code to elaborate on what is not self-evident from the code itself, including references to issues and discussions online, or implicit behavior of an interface.

Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

@ammar92 ammar92 added the documentation Improvements or additions to documentation label Jun 5, 2024
@stephanie0x00 stephanie0x00 marked this pull request as ready for review June 5, 2024 14:17
@stephanie0x00 stephanie0x00 requested a review from a team as a code owner June 5, 2024 14:18
@stephanie0x00 stephanie0x00 changed the title Documentation - developer documentation for xtdb-cli tool Documentation - developer and helper functionality documentation for xtdb-cli tool Jun 5, 2024
ammar92
ammar92 previously approved these changes Jun 10, 2024
Copy link
Contributor

@ammar92 ammar92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor suggestions, but should be ready to merge soon?

docs/source/developer_documentation/octopoes.md Outdated Show resolved Hide resolved
docs/source/developer_documentation/octopoes.md Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Jun 10, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Changes from review.

Co-authored-by: ammar92 <ammar.abdulamir@gmail.com>
@underdarknl underdarknl merged commit 3385b4d into main Jun 12, 2024
21 checks passed
@underdarknl underdarknl deleted the docs/xtdb-cli-developer-docs branch June 12, 2024 13:29
jpbruinsslot added a commit that referenced this pull request Jun 17, 2024
* main: (40 commits)
  Translations update from Hosted Weblate (#3091)
  feat: 📝 add API titles (#3055)
  Fixed 2 small mistakes in documentation (#3089)
  Documentation - developer and helper functionality documentation for xtdb-cli tool (#3023)
  fix: 🔧 update db normalize setting (#2777)
  Translations update from Hosted Weblate (#3048)
  Translations update from Hosted Weblate (#3018)
  Fix empty consumes of boefjes will trigger tasks in scheduler (#3017)
  Fixes text in secondary menu on scan profile detail page (#3035)
  chore: Resolves css-issues found by sonarcloud (#3034)
  Add raw AuthToken SQL migration (#3009)
  Translations update from Hosted Weblate (#3012)
  Rewrite xtdb-cli.py with "click" (#2957)
  Phase out the Repository model from the KATalogus (#2984)
  Fix merge conflicts in weblate (#3007)
  Translations update from Hosted Weblate (#2996)
  Reports: Fix select all OOIs (#2909)
  Adding IPv6 support to documentation for Docker setups (#2813)
  Translations update from Hosted Weblate (#2930)
  User documentation for reports (#2898)
  ...
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
4 participants