database: pull out database code into a new module

We're going to reuse the database controllers for the accounting plugin
This commit is contained in:
niftynei
2022-01-03 12:45:35 -06:00
committed by Rusty Russell
parent 03c950bae8
commit ce12d2b8a9
37 changed files with 1478 additions and 1292 deletions

View File

@@ -130,9 +130,11 @@ LIGHTNINGD_COMMON_OBJS := \
common/wallet.o \
common/wire_error.o \
common/wireaddr.o \
db/bindings.o \
db/exec.o \
$(LIGHTNINGD_OBJS): $(LIGHTNINGD_HDRS)
$(WALLET_OBJS): $(LIGHTNINGD_HDRS)
$(WALLET_OBJS): $(LIGHTNINGD_HDRS) $(DB_HEADERS)
# Only the plugin component needs to depend on this header.
lightningd/plugin.o: plugins/list_of_builtin_plugins_gen.h
@@ -140,6 +142,6 @@ lightningd/plugin.o: plugins/list_of_builtin_plugins_gen.h
lightningd/channel_state_names_gen.h: lightningd/channel_state.h ccan/ccan/cdump/tools/cdump-enumstr
ccan/ccan/cdump/tools/cdump-enumstr lightningd/channel_state.h > $@
lightningd/lightningd: $(LIGHTNINGD_OBJS) $(WALLET_OBJS) $(LIGHTNINGD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(WIRE_ONION_OBJS) $(LIGHTNINGD_CONTROL_OBJS) $(HSMD_CLIENT_OBJS)
lightningd/lightningd: $(LIGHTNINGD_OBJS) $(WALLET_OBJS) $(LIGHTNINGD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(WIRE_ONION_OBJS) $(LIGHTNINGD_CONTROL_OBJS) $(HSMD_CLIENT_OBJS) $(DB_OBJS)
include lightningd/test/Makefile

View File

@@ -14,6 +14,7 @@
#include <ccan/tal/str/str.h>
#include <common/json_helpers.h>
#include <common/memleak.h>
#include <db/exec.h>
#include <lightningd/bitcoind.h>
#include <lightningd/chaintopology.h>
#include <lightningd/io_loop_with_timers.h>

View File

@@ -11,6 +11,7 @@
#include <common/param.h>
#include <common/timeout.h>
#include <common/type_to_string.h>
#include <db/exec.h>
#include <lightningd/bitcoind.h>
#include <lightningd/chaintopology.h>
#include <lightningd/channel.h>

View File

@@ -2,6 +2,7 @@
#include <ccan/array_size/array_size.h>
#include <ccan/asort/asort.h>
#include <ccan/cast/cast.h>
#include <ccan/json_escape/json_escape.h>
#include <ccan/str/hex/hex.h>
#include <ccan/tal/str/str.h>
#include <common/bolt11_json.h>
@@ -16,6 +17,7 @@
#include <common/random_select.h>
#include <common/timeout.h>
#include <common/type_to_string.h>
#include <db/exec.h>
#include <errno.h>
#include <hsmd/hsmd_wiregen.h>
#include <lightningd/channel.h>

View File

@@ -1,6 +1,7 @@
#include "config.h"
#include <ccan/io/io.h>
#include <common/timeout.h>
#include <db/exec.h>
#include <lightningd/io_loop_with_timers.h>
#include <lightningd/lightningd.h>

View File

@@ -17,6 +17,7 @@
#include <ccan/asort/asort.h>
#include <ccan/err/err.h>
#include <ccan/io/io.h>
#include <ccan/json_escape/json_escape.h>
#include <ccan/json_out/json_out.h>
#include <ccan/tal/str/str.h>
#include <common/configdir.h>
@@ -26,6 +27,7 @@
#include <common/memleak.h>
#include <common/param.h>
#include <common/timeout.h>
#include <db/exec.h>
#include <fcntl.h>
#include <lightningd/jsonrpc.h>
#include <lightningd/plugin_hook.h>

View File

@@ -37,6 +37,7 @@
*/
#include <ccan/array_size/array_size.h>
#include <ccan/closefrom/closefrom.h>
#include <ccan/json_escape/json_escape.h>
#include <ccan/opt/opt.h>
#include <ccan/pipecmd/pipecmd.h>
#include <ccan/read_write_all/read_write_all.h>
@@ -53,6 +54,7 @@
#include <common/timeout.h>
#include <common/type_to_string.h>
#include <common/version.h>
#include <db/exec.h>
#include <errno.h>
#include <fcntl.h>

View File

@@ -1,5 +1,7 @@
#include "config.h"
#include <ccan/cast/cast.h>
#include <ccan/json_escape/json_escape.h>
#include <ccan/take/take.h>
#include <common/bolt12_merkle.h>
#include <common/json_command.h>
#include <common/json_helpers.h>

View File

@@ -2,6 +2,7 @@
#include <bitcoin/feerate.h>
#include <common/key_derive.h>
#include <common/type_to_string.h>
#include <db/exec.h>
#include <errno.h>
#include <hsmd/capabilities.h>
#include <inttypes.h>

View File

@@ -1,6 +1,7 @@
#include "config.h"
#include <ccan/array_size/array_size.h>
#include <ccan/err/err.h>
#include <ccan/json_escape/json_escape.h>
#include <ccan/mem/mem.h>
#include <ccan/opt/opt.h>
#include <ccan/opt/private.h>

View File

@@ -13,6 +13,7 @@
#include <common/param.h>
#include <common/timeout.h>
#include <common/type_to_string.h>
#include <db/exec.h>
#include <gossipd/gossipd_wiregen.h>
#include <lightningd/chaintopology.h>
#include <lightningd/channel.h>

View File

@@ -1,6 +1,8 @@
#include "config.h"
#include <ccan/io/io.h>
#include <common/memleak.h>
#include <db/exec.h>
#include <db/utils.h>
#include <lightningd/plugin_hook.h>
/* Struct containing all the information needed to deserialize and

View File

@@ -10,6 +10,7 @@
#include <common/peer_status_wiregen.h>
#include <common/status_wiregen.h>
#include <common/version.h>
#include <db/exec.h>
#include <errno.h>
#include <fcntl.h>
#include <lightningd/lightningd.h>