mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
b327bd30c3
Without this, we have hardly any enforcement. This is why the schema mistake fixed in the previous patches weren't spotted immediately. The hard work was done by: ``` $ for f in lightning-*.json; do grep -v '^ "additionalProperties": false,' $f | bagto $f; done $ for f in lightning-*.json; do sed 's/"properties": {/"additionalProperties": false, "properties": {/' $f | bagto $f; done $ make fmt-schemas ``` Then checking where 'additionalProperties: true' had been turned to false (we deliberately use it in some places where there are if statements in the schema, or occasionally where there can be arbitrary fields). [Including doc/rpc-schema-draft.json update by Shahana] Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
126 lines
2.9 KiB
JSON
126 lines
2.9 KiB
JSON
{
|
|
"$schema": "../rpc-schema-draft.json",
|
|
"type": "object",
|
|
"added": "v23.11",
|
|
"rpc": "datastoreusage",
|
|
"title": "Command for listing datastore usage info",
|
|
"description": [
|
|
"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."
|
|
],
|
|
"request": {
|
|
"required": [],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"key": {
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"description": [
|
|
"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."
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"required": [
|
|
"datastoreusage"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"datastoreusage": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"key",
|
|
"total_bytes"
|
|
],
|
|
"properties": {
|
|
"key": {
|
|
"type": "string",
|
|
"added": "v23.11",
|
|
"description": [
|
|
"The key from which the database was traversed."
|
|
]
|
|
},
|
|
"total_bytes": {
|
|
"type": "u64",
|
|
"added": "v23.11",
|
|
"description": [
|
|
"The total bytes that are stored under the *key*, including the all descendants data and the size of the keys themselves."
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"author": [
|
|
"Peter Neuroth <<pet.v.ne@gmail.com>> is mainly responsible."
|
|
],
|
|
"see_also": [
|
|
"lightning-datastore(7)",
|
|
"lightning-deldatastore(7)",
|
|
"lightning-listdatastore(7)"
|
|
],
|
|
"resources": [
|
|
"Main web site: <https://github.com/ElementsProject/lightning>"
|
|
],
|
|
"examples": [
|
|
{
|
|
"request": {
|
|
"id": "example:datastoreusage#1",
|
|
"method": "datastoreusage",
|
|
"params": {}
|
|
},
|
|
"response": {
|
|
"datastoreusage": {
|
|
"key": "[]",
|
|
"total_bytes": 55
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"id": "example:datastoreusage#2",
|
|
"method": "datastoreusage",
|
|
"params": {
|
|
"key": [
|
|
"test",
|
|
"name"
|
|
]
|
|
}
|
|
},
|
|
"response": {
|
|
"datastoreusage": {
|
|
"key": "[test,name]",
|
|
"total_bytes": 33
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"id": "example:datastoreusage#3",
|
|
"method": "datastoreusage",
|
|
"params": {
|
|
"key": "otherkey"
|
|
}
|
|
},
|
|
"response": {
|
|
"datastoreusage": {
|
|
"key": "[otherkey]",
|
|
"total_bytes": 14
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|