execute_durable_ledger_transaction_with_planner

Function execute_durable_ledger_transaction_with_planner 

Source
pub fn execute_durable_ledger_transaction_with_planner<T, F>(
    repo_root: &Path,
    kind: &str,
    batch_id_prefix: &str,
    required_manifest_path: Option<&Path>,
    dry_run: bool,
    fault: Option<FaultInjectionPoint>,
    planner_fn: F,
) -> Result<DurableTransactionOutcome<T>>
Expand description

Shared durable transactional writer used by both process_inbox_nodes and update_system_graph_ledger.

Follows the strict recovery-first, manifest-enforced protocol under LedgerWriteGuard (LOCK_EX):

  1. Repairs any torn journal suffix and resumes any open BATCH_PENDING record before calling committed-only provenance validation (planner_fn).
  2. If --require-manifest is supplied and the newly recovered (or already committed) BATCH_COMMITTED record matches manifest_sha256, verifies the final ledger and .ctbnbdl state and returns idempotently.
  3. Otherwise (Fresh-Start path), verifies baseline ledger SHA-256 and pinned input SHA-256s, runs planner_fn on the committed baseline nodes and committed_pairs, verifies byte-for-byte agreement with --require-manifest (if supplied), writes BATCH_PENDING (when !dry_run and either !planned_items.is_empty() or required_manifest.is_some()), and executes Phase 1 + Phase 2 + BATCH_COMMITTED via recover_pending_ledger_journal_with_guard.