12#include <unordered_map>
28std::string get_wsdb_schema_as_json()
37 CLI::App app{
"aztec-wsdb: Standalone world state database server" };
38 app.require_subcommand(1);
43 CLI::App* msgpack_command = app.add_subcommand(
"msgpack",
"Msgpack API interface.");
46 CLI::App* msgpack_schema_command =
47 msgpack_command->add_subcommand(
"schema",
"Output a msgpack schema encoded as JSON to stdout.");
50 CLI::App* msgpack_run_command =
51 msgpack_command->add_subcommand(
"run",
"Start the world state database IPC server.");
53 std::string input_path;
54 msgpack_run_command->add_option(
55 "-i,--input", input_path,
"IPC socket/shm path (.sock for UDS, .shm for shared memory)");
58 msgpack_run_command->add_option(
"-d,--data-dir", data_dir,
"Data directory for LMDB stores")->required();
61 std::string tree_heights_json;
62 msgpack_run_command->add_option(
"--tree-heights", tree_heights_json,
"Tree heights as JSON: {0:40,1:32,...}");
65 std::string tree_prefill_json;
66 msgpack_run_command->add_option(
67 "--tree-prefill", tree_prefill_json,
"Tree prefill sizes as JSON: {0:128,2:128,...}");
70 std::string map_sizes_json;
71 msgpack_run_command->add_option(
"--map-sizes", map_sizes_json,
"LMDB map sizes in KB as JSON: {0:1024,...}");
73 uint32_t threads = 16;
74 msgpack_run_command->add_option(
"-t,--threads", threads,
"Thread pool size (default: 16)")
75 ->check(CLI::PositiveNumber);
77 uint32_t initial_header_generator_point = 0;
78 msgpack_run_command->add_option(
79 "--initial-header-generator-point", initial_header_generator_point,
"Header generator point (default: 0)");
82 std::string prefilled_public_data_json;
83 msgpack_run_command->add_option(
84 "--prefilled-public-data", prefilled_public_data_json,
"Prefilled public data as JSON array");
86 uint64_t genesis_timestamp = 0;
87 msgpack_run_command->add_option(
"--genesis-timestamp", genesis_timestamp,
"Genesis block timestamp (default: 0)");
89 size_t request_ring_size = 1024 * 1024;
92 "--request-ring-size", request_ring_size,
"Request ring buffer size for shared memory IPC (default: 1MB)")
93 ->check(CLI::PositiveNumber);
95 size_t response_ring_size = 1024 * 1024;
97 ->add_option(
"--response-ring-size",
99 "Response ring buffer size for shared memory IPC (default: 1MB)")
100 ->check(CLI::PositiveNumber);
104 app.parse(argc, argv);
105 }
catch (
const CLI::ParseError& e) {
110 if (msgpack_schema_command->parsed()) {
115 if (msgpack_run_command->parsed()) {
122 initial_header_generator_point,
123 prefilled_public_data_json,
128 }
catch (
const std::exception& e) {
129 std::cerr <<
"Error: " << e.what() <<
'\n';
bb::bbapi::CommandResponse responses
#define SERIALIZATION_FIELDS(...)
NamedUnion< WsdbErrorResponse, WsdbGetTreeInfo::Response, WsdbGetStateReference::Response, WsdbGetInitialStateReference::Response, WsdbGetLeafValue::Response, WsdbGetLeafPreimage::Response, WsdbGetSiblingPath::Response, WsdbGetBlockNumbersForLeafIndices::Response, WsdbFindLeafIndices::Response, WsdbFindLowLeaf::Response, WsdbFindSiblingPaths::Response, WsdbAppendLeaves::Response, WsdbBatchInsert::Response, WsdbSequentialInsert::Response, WsdbUpdateArchive::Response, WsdbCommit::Response, WsdbRollback::Response, WsdbSyncBlock::Response, WsdbCreateFork::Response, WsdbDeleteFork::Response, WsdbFinalizeBlocks::Response, WsdbUnwindBlocks::Response, WsdbRemoveHistoricalBlocks::Response, WsdbGetStatus::Response, WsdbCreateCheckpoint::Response, WsdbCommitCheckpoint::Response, WsdbRevertCheckpoint::Response, WsdbCommitAllCheckpoints::Response, WsdbRevertAllCheckpoints::Response, WsdbCopyStores::Response, WsdbShutdown::Response > WsdbCommandResponse
Union of all wsdb response types.
int execute_wsdb_server(const std::string &input_path, const std::string &data_dir, const std::string &tree_heights_json, const std::string &tree_prefill_json, const std::string &map_sizes_json, uint32_t threads, uint32_t initial_header_generator_point, const std::string &prefilled_public_data_json, uint64_t genesis_timestamp, size_t request_ring_size, size_t response_ring_size)
Start the aztec-wsdb IPC server.
int parse_and_run_wsdb(int argc, char *argv[])
NamedUnion< WsdbGetTreeInfo, WsdbGetStateReference, WsdbGetInitialStateReference, WsdbGetLeafValue, WsdbGetLeafPreimage, WsdbGetSiblingPath, WsdbGetBlockNumbersForLeafIndices, WsdbFindLeafIndices, WsdbFindLowLeaf, WsdbFindSiblingPaths, WsdbAppendLeaves, WsdbBatchInsert, WsdbSequentialInsert, WsdbUpdateArchive, WsdbCommit, WsdbRollback, WsdbSyncBlock, WsdbCreateFork, WsdbDeleteFork, WsdbFinalizeBlocks, WsdbUnwindBlocks, WsdbRemoveHistoricalBlocks, WsdbGetStatus, WsdbCreateCheckpoint, WsdbCommitCheckpoint, WsdbRevertCheckpoint, WsdbCommitAllCheckpoints, WsdbRevertAllCheckpoints, WsdbCopyStores, WsdbShutdown > WsdbCommand
Union of all wsdb commands (request types).
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string msgpack_schema_to_string(const auto &obj)
Print's an object's derived msgpack schema as a string.
WsdbCommand NamedUnion, WsdbRequest context, and dispatch function.