LIGHTNING-DATASTOREUSAGE(7)

πŸ“¦
version 26.06.9 Β· 2 versions
, in nixpkgs unstable

πŸ’… LIGHTNING-DATASTOREUSAGE (7) πŸ’…

okay bestie, so this is a page from the LIGHTNING-DATASTOREUSAGE manual β€” yes the whole name twice at the top, that's just how manpages do, iconic behavior honestly. it's all about datastoreusage, and ngl it's a little cutie.


✨ NAME ✨

datastoreusage β€” the command for listing datastore usage info. that's it, that's the whole vibe πŸŽ€


🌸 SYNOPSIS 🌸

datastoreusage [key]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first thing: this command was added in v23.11, so if you're on something ancient it simply does not exist, sorry bestie πŸ’€

The datastoreusage RPC command lets the caller fetch the total bytes that are stored under a certain key (or from the root), including the size of the key itself. yes, the key's own size counts too, it's only fair πŸ’…

All descendants of the key (or the root) are taken into account. every single one. the whole family tree. no cap 🌳

  • key (one of, optional):
    • (array of strings): Key is an array of values (though a single value is treated as a one-element array, cute right?). Used as the starting point to traverse the datastore.
    • (string, optional)
    • (string)
lowkey important: that second and third bullet are literally just (string, optional) and (string) in the original β€” not me being lazy, that's the actual documentation energy. i'm keeping it real, fr fr πŸ™ˆ

πŸ”₯ RETURN VALUE πŸ”₯

On success, an object containing datastoreusage is returned. and that object contains:

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

so yeah, total_bytes counts the descendants and the key sizes. it's giving thorough πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

Peter Neuroth pet.v.ne@gmail.com is mainly responsible. thank you Peter, you ate πŸ’–


🌈 SEE ALSO 🌈

go read those next, bestie, they're the sibling group chat 🫢


⭐ 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": 2909
  }
}

Example 2:

Request:

$ lightning-cli datastoreusage -k "key"='["test", "name"]'
{
  "id": "example:datastoreusage#2",
  "method": "datastoreusage",
  "params": {
    "key": [
      "test",
      "name"
    ]
  }
}

Response:

{
  "datastoreusage": {
    "key": "[test,name]",
    "total_bytes": 33
  }
}

Example 3:

Request:

$ lightning-cli datastoreusage -k "key"="otherkey"
{
  "id": "example:datastoreusage#3",
  "method": "datastoreusage",
  "params": {
    "key": "otherkey"
  }
}

Response:

{
  "datastoreusage": {
    "key": "[otherkey]",
    "total_bytes": 54
  }
}

k that's the whole page!! 🌸 this masterpiece is brought to you by Core Lightning v26.06.9, mwah, go check your datastore usage, ily, bye πŸ’œβœ¨

πŸ“¦ where this page comes from