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

61 lines
1.6 KiB
Groff
Generated

.TH "LIGHTNING-DATASTORE" "7" "" "" "lightning-datastore"
.SH NAME
lightning-datastore - Command for storing (plugin) data
.SH SYNOPSIS
\fBdatastore\fR \fIkey\fR [\fIstring\fR] [\fIhex\fR] [\fImode\fR]
.SH DESCRIPTION
The \fBdatastore\fR RPC command allows plugins to store data in the
c-lightning database, for later retrieval\.
There can only be one entry for each \fIkey\fR, so prefixing with the
plugin name (e\.g\. \fBsummary.\fR) is recommended\.
\fImode\fR 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)\.
.SH RETURN VALUE
On success, an object is returned, containing:
.RS
.IP \[bu]
\fBkey\fR (string): The key which has been added to the datastore
.IP \[bu]
\fBhex\fR (hex): The hex data which has been added to the datastore
.IP \[bu]
\fBstring\fR (string, optional): The data as a string, if it's valid utf-8
.RE
The main cause of failure is an already-existing entry\.
The following error codes may occur:
.RS
.IP \[bu]
-32602: invalid parameters, including already-existing/not-existing key\.
.RE
.SH AUTHOR
Rusty Russell \fI<rusty@rustcorp.com.au\fR> is mainly responsible\.
.SH SEE ALSO
\fBlightning-listdatastore\fR(7), \fBlightning-deldatastore\fR(7)
.SH RESOURCES
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
\" SHA256STAMP:4bb1369465ffb76e8e1962bd9e242159e579bb3af6e01c9d1461e519d8721769