lightning-datastoreusage

lightning-datastoreusage -- Command for listing datastore usage info

SYNOPSIS

datastoreusage [key]

DESCRIPTION

Command added in v23.11.

The datastoreusage RPC command allows the caller to fetch the total bytes that are stored under a certain key (or from the root), including the size of the key.

All descendants of the key (or root) are taken into account.

  • key (one of, optional):
    • (array of strings): Key is an array of values (though a single value is treated as a one-element array). Used as the starting point to traverse the datastore.
      • (string, optional)
    • (string)

RETURN VALUE

On success, an object containing datastoreusage is returned. It is an object containing:

  • key (string): The key from which the database was traversed. (added v23.11)
  • total_bytes (u64): The total bytes that are stored under the key, including the all descendants data and the size of the keys themselves. (added v23.11)

AUTHOR

Peter Neuroth <[email protected]> is mainly responsible.

SEE ALSO

lightning-datastore(7), lightning-deldatastore(7), lightning-listdatastore(7)

RESOURCES

Main web site: https://github.com/ElementsProject/lightning

EXAMPLES

Example 1:

Request:

lightning-cli datastoreusage
{
  "id": "example:datastoreusage#1",
  "method": "datastoreusage",
  "params": {}
}

Response:

{
  "datastoreusage": {
    "key": "[]",
    "total_bytes": 0
  }
}

Example 2:

Request:

lightning-cli datastoreusage -k "key"="a"
{
  "id": "example:datastoreusage#2",
  "method": "datastoreusage",
  "params": {
    "key": "a"
  }
}

Response:

{
  "datastoreusage": {
    "key": "[a]",
    "total_bytes": 32
  }
}

Example 3:

Request:

lightning-cli datastoreusage -k "key"='["a", "thisissomelongkeythattriestostore46bytesofdata"]'
{
  "id": "example:datastoreusage#3",
  "method": "datastoreusage",
  "params": {
    "key": [
      "a",
      "thisissomelongkeythattriestostore46bytesofdata"
    ]
  }
}

Response:

{
  "datastoreusage": {
    "key": "[a,thisissomelongkeythattriestostore46bytesofdata]",
    "total_bytes": 77
  }
}