2021-08-25 04:50:12 +02:00
|
|
|
lightning-datastore -- Command for storing (plugin) data
|
|
|
|
========================================================
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
|
2022-01-26 18:18:49 +01:00
|
|
|
**datastore** *key* [*string*] [*hex*] [*mode*] [*generation*]
|
2021-08-25 04:50:12 +02:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
|
|
|
|
The **datastore** RPC command allows plugins to store data in the
|
2022-04-06 07:09:48 +02:00
|
|
|
Core Lightning database, for later retrieval.
|
2021-08-25 04:50:12 +02:00
|
|
|
|
2021-08-25 04:51:34 +02:00
|
|
|
*key* is an array of values (though a single value is treated as a
|
2021-12-02 09:48:25 +01:00
|
|
|
one-element array), to form a hierarchy. Using the first element of
|
2021-08-25 04:51:34 +02:00
|
|
|
the key as the plugin name (e.g. `[ "summary" ]`) is recommended.
|
|
|
|
A key can either have children or a value, never both: parents are
|
|
|
|
created and removed automatically.
|
2021-08-25 04:50:12 +02:00
|
|
|
|
2021-12-02 09:48:25 +01:00
|
|
|
*mode* is one of "must-create" (default, fails if it already exists),
|
|
|
|
"must-replace" (fails if it doesn't already exist),
|
2021-08-25 04:50:37 +02:00
|
|
|
"create-or-replace" (never fails), "must-append" (must already exist,
|
|
|
|
append this to what's already there) or "create-or-append" (append if
|
|
|
|
anything is there, otherwise create).
|
|
|
|
|
2021-08-25 04:51:04 +02:00
|
|
|
*generation*, if specified, means that the update will fail if the
|
|
|
|
previously-existing data is not exactly that generation. This allows
|
|
|
|
for simple atomicity. This is only legal with *mode* "must-replace"
|
|
|
|
or "must-append".
|
|
|
|
|
2021-08-25 04:50:12 +02:00
|
|
|
RETURN VALUE
|
|
|
|
------------
|
|
|
|
|
|
|
|
[comment]: # (GENERATE-FROM-SCHEMA-START)
|
|
|
|
On success, an object is returned, containing:
|
2021-08-25 04:51:34 +02:00
|
|
|
- **key** (array of strings):
|
|
|
|
- Part of the key added to the datastore
|
|
|
|
- **generation** (u64, optional): The number of times this has been updated
|
|
|
|
- **hex** (hex, optional): The hex data which has been added to the datastore
|
2021-08-25 04:50:13 +02:00
|
|
|
- **string** (string, optional): The data as a string, if it's valid utf-8
|
2021-09-03 12:07:59 +02:00
|
|
|
|
2021-08-25 04:50:12 +02:00
|
|
|
[comment]: # (GENERATE-FROM-SCHEMA-END)
|
|
|
|
|
|
|
|
The following error codes may occur:
|
2021-08-25 04:51:04 +02:00
|
|
|
- 1202: The key already exists (and mode said it must not)
|
|
|
|
- 1203: The key does not exist (and mode said it must)
|
|
|
|
- 1204: The generation was wrong (and generation was specified)
|
2021-08-25 04:51:34 +02:00
|
|
|
- 1205: The key has children already.
|
|
|
|
- 1206: One of the parents already exists with a value.
|
2021-08-25 04:51:04 +02:00
|
|
|
- -32602: invalid parameters
|
2021-08-25 04:50:12 +02:00
|
|
|
|
|
|
|
AUTHOR
|
|
|
|
------
|
|
|
|
|
|
|
|
Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible.
|
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
|
|
|
|
|
|
|
lightning-listdatastore(7), lightning-deldatastore(7)
|
|
|
|
|
|
|
|
RESOURCES
|
|
|
|
---------
|
|
|
|
|
|
|
|
Main web site: <https://github.com/ElementsProject/lightning>
|
|
|
|
|
2022-07-13 17:45:39 +02:00
|
|
|
[comment]: # ( SHA256STAMP:ce6a72f08dd7f6026eab58bb6ea732aead4512e714fab4f9a1cf54cdb1374f59)
|