2024-01-15 13:35:14 -08:00
{
"$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" : [ ] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"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"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"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."
]
}
}
}
}
} ,
2024-06-20 14:57:02 -07:00
"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" : [
2024-01-15 13:35:14 -08:00
{
2024-03-27 18:45:18 -07:00
"request" : {
"id" : "example:datastoreusage#1" ,
"method" : "datastoreusage" ,
2024-06-18 14:49:51 -07:00
"params" : { }
2024-03-27 18:45:18 -07:00
} ,
"response" : {
"datastoreusage" : {
"key" : "[]" ,
2024-07-18 00:28:22 -07:00
"total_bytes" : 55
2024-03-27 18:45:18 -07:00
}
2024-01-15 13:35:14 -08:00
}
} ,
{
2024-03-27 18:45:18 -07:00
"request" : {
"id" : "example:datastoreusage#2" ,
"method" : "datastoreusage" ,
"params" : {
2024-07-18 00:28:22 -07:00
"key" : [
"test" ,
"name"
]
2024-03-27 18:45:18 -07:00
}
} ,
"response" : {
"datastoreusage" : {
2024-07-18 00:28:22 -07:00
"key" : "[test,name]" ,
"total_bytes" : 33
2024-03-27 18:45:18 -07:00
}
2024-01-15 13:35:14 -08:00
}
} ,
{
2024-03-27 18:45:18 -07:00
"request" : {
"id" : "example:datastoreusage#3" ,
"method" : "datastoreusage" ,
"params" : {
2024-07-18 00:28:22 -07:00
"key" : "otherkey"
2024-03-27 18:45:18 -07:00
}
} ,
"response" : {
"datastoreusage" : {
2024-07-18 00:28:22 -07:00
"key" : "[otherkey]" ,
"total_bytes" : 14
2024-03-27 18:45:18 -07:00
}
2024-01-15 13:35:14 -08:00
}
}
]
}