feat: recognise type=none as null-nodestore config

NullFactory (type=none) already provides the exact null-backend
semantics: fetchNodeObject returns notFound, store is a no-op, no disk
I/O. Previously SHAMapStoreImp treated any non-"rwdb" type as
disk-backed and called dbPaths() unconditionally, crashing with
boost::filesystem::create_directories on an empty path.

- Recognise "none" alongside "rwdb" as a memory backend (skips
  dbPaths() and takes the memory-backend rotation path).
- On type=none, set XAHAU_RWDB_NULL=1 (overwrite=0) so the existing
  isRWDBNullMode() helpers in SHAMapSync, InboundLedger, Ledger etc.
  detect null-mode semantics (FBC liveness+anchor, setFullyWired,
  rotation-copy skip) without requiring the env var to be set
  separately.

Makes type=none a first-class null-backend config declaration,
equivalent to type=rwdb + XAHAU_RWDB_NULL=1 but without the env-var
dance. Users can now write:

  [node_db]
  type = none
  online_delete = 16
This commit is contained in:
Nicholas Dudfield
2026-04-14 13:48:32 +07:00
parent 1ce1079dda
commit 7995cd5792

View File

@@ -154,7 +154,17 @@ SHAMapStoreImp::SHAMapStoreImp(
}
get_if_exists(section, "online_delete", deleteInterval_);
isMemoryBackend_ = boost::iequals(get(section, "type"), "rwdb");
auto const backendType = get(section, "type");
isMemoryBackend_ = boost::iequals(backendType, "rwdb") ||
boost::iequals(backendType, "none");
// type=none is the declared null-nodestore config (via NullFactory).
// Propagate to XAHAU_RWDB_NULL so isRWDBNullMode() in other components
// (SHAMapSync, InboundLedger, Ledger) picks up null-mode semantics via
// their file-local helpers. overwrite=0 preserves any value the user
// has already set.
if (boost::iequals(backendType, "none"))
::setenv("XAHAU_RWDB_NULL", "1", 0);
// For RWDB, default online_delete to ledger_history only if user did not
// explicitly set online_delete. Clamp to the minimum so an implicit