Files
lightning/doc/lightning-datastore.7.md
Rusty Russell 432508e65e datastore: allow replace/append.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-08-25 10:06:31 +02:00

1.6 KiB

lightning-datastore -- Command for storing (plugin) data

SYNOPSIS

datastore key [string] [hex] [mode]

DESCRIPTION

The datastore RPC command allows plugins to store data in the c-lightning database, for later retrieval.

There can only be one entry for each key, so prefixing with the plugin name (e.g. summary.) is recommended.

mode is one of "must-create" (default, fails it it already exists), "must-replace" (fails it it doesn't already exist), "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).

RETURN VALUE

On success, an object is returned, containing:

  • key (string): The key which has been added to the datastore
  • hex (hex): The hex data which has been added to the datastore
  • string (string, optional): The data as a string, if it's valid utf-8 comment: # (GENERATE-FROM-SCHEMA-END)

The main cause of failure is an already-existing entry.

The following error codes may occur:

  • -32602: invalid parameters, including already-existing/not-existing key.

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