@feltdb/core 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/agent-state.d.ts +20 -0
  2. package/dist/agent-state.d.ts.map +1 -1
  3. package/dist/agent-state.js +36 -0
  4. package/dist/build-identity.json +12 -4
  5. package/dist/cli/commands.js +187 -4
  6. package/dist/cli/publish-engine.js +116 -16
  7. package/dist/collection.d.ts.map +1 -1
  8. package/dist/collection.js +3 -0
  9. package/dist/create/build-identity.json +12 -4
  10. package/dist/create/managed-account.js +93 -35
  11. package/dist/create/package-versions.js +1 -1
  12. package/dist/create/server-source/Cargo.lock +6 -509
  13. package/dist/create/server-source/Cargo.toml +2 -13
  14. package/dist/create/server-source/crates/feltdb-client/Cargo.toml +1 -1
  15. package/dist/create/server-source/crates/feltdb-server/Cargo.toml +1 -1
  16. package/dist/create/server-source/crates/feltdb-server/src/main.rs +255 -12
  17. package/dist/create/server-source/crates/feltdb-wasm/Cargo.toml +1 -1
  18. package/dist/db.d.ts +11 -1
  19. package/dist/db.d.ts.map +1 -1
  20. package/dist/db.js +15 -2
  21. package/dist/error-codes.d.ts +5 -0
  22. package/dist/error-codes.d.ts.map +1 -1
  23. package/dist/error-codes.js +9 -1
  24. package/dist/http-db.d.ts +16 -0
  25. package/dist/http-db.d.ts.map +1 -1
  26. package/dist/http-db.js +36 -6
  27. package/dist/managed-recovery.d.ts +6 -0
  28. package/dist/managed-recovery.d.ts.map +1 -1
  29. package/dist/managed-recovery.js +9 -0
  30. package/dist/studio-app/assets/{feltdb_wasm-BjM1ylL3.js → feltdb_wasm-DtybUY0q.js} +1 -1
  31. package/dist/studio-app/assets/feltdb_wasm_bg-DsgIUwaB.wasm +0 -0
  32. package/dist/studio-app/assets/index-C4OffsZl.js +37 -0
  33. package/dist/studio-app/index.html +1 -1
  34. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  35. package/dist/wasm/package.json +1 -1
  36. package/dist/workload.d.ts +55 -3
  37. package/dist/workload.d.ts.map +1 -1
  38. package/dist/workload.js +23 -0
  39. package/dist/workspace/workspace-connection.d.ts.map +1 -1
  40. package/dist/workspace/workspace-connection.js +14 -3
  41. package/package.json +1 -1
  42. package/dist/create/server-source/crates/feltdb/Cargo.lock +0 -175
  43. package/dist/create/server-source/crates/feltdb/Cargo.toml +0 -102
  44. package/dist/create/server-source/crates/feltdb/LICENSE +0 -21
  45. package/dist/create/server-source/crates/feltdb/README.md +0 -75
  46. package/dist/create/server-source/crates/feltdb/benches/baselines/gate-13-redux.json +0 -370
  47. package/dist/create/server-source/crates/feltdb/benches/gate13_baseline.rs +0 -589
  48. package/dist/create/server-source/crates/feltdb/benches/gate13_phase_7_1_release_economics.rs +0 -247
  49. package/dist/create/server-source/crates/feltdb/benches/gate_13_redux.rs +0 -440
  50. package/dist/create/server-source/crates/feltdb/benches/gate_13_regression_runner.rs +0 -275
  51. package/dist/create/server-source/crates/feltdb/benches/gate_14a_concurrent_writer_scaling.rs +0 -381
  52. package/dist/create/server-source/crates/feltdb/benches/gate_14a_production_admission_revalidation.rs +0 -467
  53. package/dist/create/server-source/crates/feltdb/benches/gate_14a_rc2_admission_contract.rs +0 -489
  54. package/dist/create/server-source/crates/feltdb/benches/gate_14a_rc_root_cause.rs +0 -281
  55. package/dist/create/server-source/crates/feltdb/benches/gate_14a_sync1_queued_prototype.rs +0 -606
  56. package/dist/create/server-source/crates/feltdb/benches/gate_14a_sync_economics.rs +0 -531
  57. package/dist/create/server-source/crates/feltdb/benches/gate_14b_causal_backlog_scaling.rs +0 -462
  58. package/dist/create/server-source/crates/feltdb/benches/gate_14c_replication_contract_test.rs +0 -505
  59. package/dist/create/server-source/crates/feltdb/benches/gate_14c_replication_scaling.rs +0 -484
  60. package/dist/create/server-source/crates/feltdb/benches/gate_14d_combined_dimension_scaling.rs +0 -758
  61. package/dist/create/server-source/crates/feltdb/benches/phase_7_1_2_optimization_benchmark.rs +0 -421
  62. package/dist/create/server-source/crates/feltdb/benches/phase_7_1_3_crossover_analysis.rs +0 -329
  63. package/dist/create/server-source/crates/feltdb/src/acceptance_tests.rs +0 -1705
  64. package/dist/create/server-source/crates/feltdb/src/acquisition.rs +0 -286
  65. package/dist/create/server-source/crates/feltdb/src/admission.rs +0 -185
  66. package/dist/create/server-source/crates/feltdb/src/admission_contract_tests.rs +0 -507
  67. package/dist/create/server-source/crates/feltdb/src/adversarial_transport.rs +0 -539
  68. package/dist/create/server-source/crates/feltdb/src/agent_state.rs +0 -320
  69. package/dist/create/server-source/crates/feltdb/src/agent_transition_contract.rs +0 -1545
  70. package/dist/create/server-source/crates/feltdb/src/analytics.rs +0 -521
  71. package/dist/create/server-source/crates/feltdb/src/application.rs +0 -2674
  72. package/dist/create/server-source/crates/feltdb/src/application_runtime.rs +0 -1070
  73. package/dist/create/server-source/crates/feltdb/src/authority.rs +0 -479
  74. package/dist/create/server-source/crates/feltdb/src/authority_failover.rs +0 -847
  75. package/dist/create/server-source/crates/feltdb/src/authorization.rs +0 -1030
  76. package/dist/create/server-source/crates/feltdb/src/authorization_security_tests.rs +0 -1122
  77. package/dist/create/server-source/crates/feltdb/src/bin/feltdb-authority-client.rs +0 -32
  78. package/dist/create/server-source/crates/feltdb/src/bin/feltdb-authority.rs +0 -19
  79. package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +0 -1474
  80. package/dist/create/server-source/crates/feltdb/src/capabilities/mod.rs +0 -8
  81. package/dist/create/server-source/crates/feltdb/src/capabilities/search.rs +0 -418
  82. package/dist/create/server-source/crates/feltdb/src/capabilities/vector.rs +0 -482
  83. package/dist/create/server-source/crates/feltdb/src/capability.rs +0 -903
  84. package/dist/create/server-source/crates/feltdb/src/cardinality_diagnostics.rs +0 -263
  85. package/dist/create/server-source/crates/feltdb/src/cardinality_endpoint.rs +0 -77
  86. package/dist/create/server-source/crates/feltdb/src/causal_backlog_bound.rs +0 -496
  87. package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier.rs +0 -2574
  88. package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier_phase_7_1.rs +0 -212
  89. package/dist/create/server-source/crates/feltdb/src/concurrency_fuzzing.rs +0 -422
  90. package/dist/create/server-source/crates/feltdb/src/consistency_contract.rs +0 -445
  91. package/dist/create/server-source/crates/feltdb/src/content_distribution.rs +0 -465
  92. package/dist/create/server-source/crates/feltdb/src/convergence.rs +0 -634
  93. package/dist/create/server-source/crates/feltdb/src/crash_atomic_boundary.rs +0 -427
  94. package/dist/create/server-source/crates/feltdb/src/crash_injection.rs +0 -376
  95. package/dist/create/server-source/crates/feltdb/src/crash_recovery_tests.rs +0 -365
  96. package/dist/create/server-source/crates/feltdb/src/cron.rs +0 -294
  97. package/dist/create/server-source/crates/feltdb/src/dedup_bound_investigation.rs +0 -483
  98. package/dist/create/server-source/crates/feltdb/src/distributed_indexing.rs +0 -477
  99. package/dist/create/server-source/crates/feltdb/src/distributed_tests.rs +0 -1003
  100. package/dist/create/server-source/crates/feltdb/src/distributed_transactions.rs +0 -1334
  101. package/dist/create/server-source/crates/feltdb/src/durability_guarantees.rs +0 -368
  102. package/dist/create/server-source/crates/feltdb/src/durable_dedup_set.rs +0 -231
  103. package/dist/create/server-source/crates/feltdb/src/durable_operation_identity.rs +0 -482
  104. package/dist/create/server-source/crates/feltdb/src/durable_operation_log.rs +0 -203
  105. package/dist/create/server-source/crates/feltdb/src/durable_sync.rs +0 -317
  106. package/dist/create/server-source/crates/feltdb/src/equality_index.rs +0 -595
  107. package/dist/create/server-source/crates/feltdb/src/execution.rs +0 -426
  108. package/dist/create/server-source/crates/feltdb/src/in_process_transport.rs +0 -214
  109. package/dist/create/server-source/crates/feltdb/src/indexing.rs +0 -776
  110. package/dist/create/server-source/crates/feltdb/src/lib.rs +0 -7365
  111. package/dist/create/server-source/crates/feltdb/src/managed_cas_tests.rs +0 -234
  112. package/dist/create/server-source/crates/feltdb/src/materialization.rs +0 -184
  113. package/dist/create/server-source/crates/feltdb/src/metrics.rs +0 -266
  114. package/dist/create/server-source/crates/feltdb/src/multi_node_convergence.rs +0 -310
  115. package/dist/create/server-source/crates/feltdb/src/multi_operation_transaction.rs +0 -736
  116. package/dist/create/server-source/crates/feltdb/src/observability.rs +0 -379
  117. package/dist/create/server-source/crates/feltdb/src/operation.rs +0 -290
  118. package/dist/create/server-source/crates/feltdb/src/operation_algebra.rs +0 -439
  119. package/dist/create/server-source/crates/feltdb/src/operation_log.rs +0 -349
  120. package/dist/create/server-source/crates/feltdb/src/p1_application_atomicity.rs +0 -332
  121. package/dist/create/server-source/crates/feltdb/src/p1_atomicity_acceptance.rs +0 -718
  122. package/dist/create/server-source/crates/feltdb/src/partition_reconciliation.rs +0 -487
  123. package/dist/create/server-source/crates/feltdb/src/peer_registry.rs +0 -166
  124. package/dist/create/server-source/crates/feltdb/src/permutation_scheduler.rs +0 -289
  125. package/dist/create/server-source/crates/feltdb/src/persistence_reality.rs +0 -566
  126. package/dist/create/server-source/crates/feltdb/src/phase1b_acceptance.rs +0 -3391
  127. package/dist/create/server-source/crates/feltdb/src/phase1c1_acceptance.rs +0 -203
  128. package/dist/create/server-source/crates/feltdb/src/phase1c2_acceptance.rs +0 -261
  129. package/dist/create/server-source/crates/feltdb/src/phase1c3_acceptance.rs +0 -502
  130. package/dist/create/server-source/crates/feltdb/src/phase1c_atomicity_proof.rs +0 -216
  131. package/dist/create/server-source/crates/feltdb/src/phase5_integration.rs +0 -303
  132. package/dist/create/server-source/crates/feltdb/src/phase5_scenarios.rs +0 -323
  133. package/dist/create/server-source/crates/feltdb/src/phase6_adversarial_scenarios.rs +0 -531
  134. package/dist/create/server-source/crates/feltdb/src/phase6_convergence_validator.rs +0 -406
  135. package/dist/create/server-source/crates/feltdb/src/phase6_persistence.rs +0 -436
  136. package/dist/create/server-source/crates/feltdb/src/phase_1c_real_tcp.rs +0 -387
  137. package/dist/create/server-source/crates/feltdb/src/phase_2a_failures.rs +0 -378
  138. package/dist/create/server-source/crates/feltdb/src/phase_2b_network.rs +0 -359
  139. package/dist/create/server-source/crates/feltdb/src/phase_2c_cascading.rs +0 -372
  140. package/dist/create/server-source/crates/feltdb/src/phase_3_durability.rs +0 -404
  141. package/dist/create/server-source/crates/feltdb/src/phase_4_baseline.rs +0 -376
  142. package/dist/create/server-source/crates/feltdb/src/phase_5_soak.rs +0 -461
  143. package/dist/create/server-source/crates/feltdb/src/policy_evaluation.rs +0 -2125
  144. package/dist/create/server-source/crates/feltdb/src/production_api.rs +0 -418
  145. package/dist/create/server-source/crates/feltdb/src/provenance.rs +0 -207
  146. package/dist/create/server-source/crates/feltdb/src/query_execution_diagnostics.rs +0 -126
  147. package/dist/create/server-source/crates/feltdb/src/query_performance.rs +0 -218
  148. package/dist/create/server-source/crates/feltdb/src/read_basis.rs +0 -257
  149. package/dist/create/server-source/crates/feltdb/src/references.rs +0 -404
  150. package/dist/create/server-source/crates/feltdb/src/replay_fuzzing.rs +0 -401
  151. package/dist/create/server-source/crates/feltdb/src/replica_acknowledgements.rs +0 -501
  152. package/dist/create/server-source/crates/feltdb/src/replica_membership.rs +0 -680
  153. package/dist/create/server-source/crates/feltdb/src/replication_manager.rs +0 -163
  154. package/dist/create/server-source/crates/feltdb/src/replication_protocol.rs +0 -133
  155. package/dist/create/server-source/crates/feltdb/src/routing.rs +0 -409
  156. package/dist/create/server-source/crates/feltdb/src/semantic_decision.rs +0 -2029
  157. package/dist/create/server-source/crates/feltdb/src/semantic_query.rs +0 -599
  158. package/dist/create/server-source/crates/feltdb/src/sharding.rs +0 -549
  159. package/dist/create/server-source/crates/feltdb/src/state_conflict_contract.rs +0 -516
  160. package/dist/create/server-source/crates/feltdb/src/state_contract.rs +0 -6003
  161. package/dist/create/server-source/crates/feltdb/src/state_diff_contract.rs +0 -222
  162. package/dist/create/server-source/crates/feltdb/src/state_facade.rs +0 -320
  163. package/dist/create/server-source/crates/feltdb/src/state_hash.rs +0 -291
  164. package/dist/create/server-source/crates/feltdb/src/state_model.rs +0 -4158
  165. package/dist/create/server-source/crates/feltdb/src/state_transition_store.rs +0 -379
  166. package/dist/create/server-source/crates/feltdb/src/state_trigger.rs +0 -673
  167. package/dist/create/server-source/crates/feltdb/src/storage.rs +0 -273
  168. package/dist/create/server-source/crates/feltdb/src/submission.rs +0 -471
  169. package/dist/create/server-source/crates/feltdb/src/sync.rs +0 -495
  170. package/dist/create/server-source/crates/feltdb/src/sync_contract.rs +0 -822
  171. package/dist/create/server-source/crates/feltdb/src/tcp_transport.rs +0 -433
  172. package/dist/create/server-source/crates/feltdb/src/transaction_api.rs +0 -462
  173. package/dist/create/server-source/crates/feltdb/src/transaction_invariants.rs +0 -965
  174. package/dist/create/server-source/crates/feltdb/src/transaction_preconditions.rs +0 -1120
  175. package/dist/create/server-source/crates/feltdb/src/transactions.rs +0 -643
  176. package/dist/create/server-source/crates/feltdb/src/trigger.rs +0 -390
  177. package/dist/create/server-source/crates/feltdb/src/trigger_contract.rs +0 -749
  178. package/dist/create/server-source/crates/feltdb/src/versioned_object_substrate.rs +0 -708
  179. package/dist/create/server-source/crates/feltdb/src/worker_mesh.rs +0 -1269
  180. package/dist/create/server-source/crates/feltdb/src/workflow.rs +0 -713
  181. package/dist/create/server-source/crates/feltdb/src/workflow_acceptance_tests.rs +0 -510
  182. package/dist/create/server-source/crates/feltdb/src/workflow_integration.rs +0 -354
  183. package/dist/create/server-source/crates/feltdb/src/workflow_runtime.rs +0 -594
  184. package/dist/create/server-source/crates/feltdb/src/workload.rs +0 -4222
  185. package/dist/create/server-source/crates/feltdb/src/workload_diagnostics.rs +0 -456
  186. package/dist/create/server-source/crates/feltdb/tests/agent_state_native.rs +0 -1188
  187. package/dist/create/server-source/crates/feltdb/tests/agent_transition_contract_conformance.rs +0 -2884
  188. package/dist/create/server-source/crates/feltdb/tests/authority_process.rs +0 -297
  189. package/dist/create/server-source/crates/feltdb/tests/authority_transaction_identity.rs +0 -534
  190. package/dist/create/server-source/crates/feltdb/tests/bounded_read_contract.rs +0 -132
  191. package/dist/create/server-source/crates/feltdb/tests/branching_evidence.rs +0 -299
  192. package/dist/create/server-source/crates/feltdb/tests/common/mod.rs +0 -96
  193. package/dist/create/server-source/crates/feltdb/tests/compaction_stall_contract.rs +0 -272
  194. package/dist/create/server-source/crates/feltdb/tests/crash_durability_contract.rs +0 -467
  195. package/dist/create/server-source/crates/feltdb/tests/current_revision_authority_evidence.rs +0 -309
  196. package/dist/create/server-source/crates/feltdb/tests/durable_backup_contract.rs +0 -445
  197. package/dist/create/server-source/crates/feltdb/tests/durable_corruption_contract.rs +0 -518
  198. package/dist/create/server-source/crates/feltdb/tests/durable_format_compatibility.rs +0 -392
  199. package/dist/create/server-source/crates/feltdb/tests/feltdb_state_boundary_tests.rs +0 -850
  200. package/dist/create/server-source/crates/feltdb/tests/fixtures/agent_transition_corpus.json +0 -23340
  201. package/dist/create/server-source/crates/feltdb/tests/fixtures/state_conflict_contract_corpus.json +0 -1916
  202. package/dist/create/server-source/crates/feltdb/tests/fixtures/state_diff_contract_corpus.json +0 -1878
  203. package/dist/create/server-source/crates/feltdb/tests/fixtures/trigger_contract_corpus.json +0 -1862
  204. package/dist/create/server-source/crates/feltdb/tests/generalized_version_control_evidence.rs +0 -123
  205. package/dist/create/server-source/crates/feltdb/tests/generalized_version_control_substrate_completion.rs +0 -299
  206. package/dist/create/server-source/crates/feltdb/tests/local_process_ownership.rs +0 -69
  207. package/dist/create/server-source/crates/feltdb/tests/managed_incident_regression.rs +0 -191
  208. package/dist/create/server-source/crates/feltdb/tests/operational_health_contract.rs +0 -278
  209. package/dist/create/server-source/crates/feltdb/tests/pr34_query_collection.rs +0 -234
  210. package/dist/create/server-source/crates/feltdb/tests/pr35_equality_index.rs +0 -947
  211. package/dist/create/server-source/crates/feltdb/tests/pr7_self_authorization_proof.rs +0 -404
  212. package/dist/create/server-source/crates/feltdb/tests/pr8_vocabulary_assessment.rs +0 -916
  213. package/dist/create/server-source/crates/feltdb/tests/pr9_phase2_boundary_tests.rs +0 -1045
  214. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3a_path_a_tests.rs +0 -347
  215. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_authorized_mutations.rs +0 -361
  216. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_role_based_authorization.rs +0 -330
  217. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_simple_auth_delete.rs +0 -93
  218. package/dist/create/server-source/crates/feltdb/tests/pr9_phase3c_team_delete_role_authorization.rs +0 -622
  219. package/dist/create/server-source/crates/feltdb/tests/pr9_teams_role_based_access.rs +0 -517
  220. package/dist/create/server-source/crates/feltdb/tests/production_certification.rs +0 -1153
  221. package/dist/create/server-source/crates/feltdb/tests/production_contract.rs +0 -771
  222. package/dist/create/server-source/crates/feltdb/tests/production_readiness_contract.rs +0 -1383
  223. package/dist/create/server-source/crates/feltdb/tests/reconciliation_application.rs +0 -868
  224. package/dist/create/server-source/crates/feltdb/tests/reconciliation_wire_format_evidence.rs +0 -221
  225. package/dist/create/server-source/crates/feltdb/tests/replicated_history_contract.rs +0 -417
  226. package/dist/create/server-source/crates/feltdb/tests/resource_scoped_revisions.rs +0 -338
  227. package/dist/create/server-source/crates/feltdb/tests/revision_identity_contract.rs +0 -1039
  228. package/dist/create/server-source/crates/feltdb/tests/revision_model_decision.rs +0 -739
  229. package/dist/create/server-source/crates/feltdb/tests/revision_retention_boundary_evidence.rs +0 -452
  230. package/dist/create/server-source/crates/feltdb/tests/saas_authorization_integration.rs +0 -81
  231. package/dist/create/server-source/crates/feltdb/tests/saas_invitation_lifecycle.rs +0 -438
  232. package/dist/create/server-source/crates/feltdb/tests/semantic_decision.rs +0 -1165
  233. package/dist/create/server-source/crates/feltdb/tests/semantic_query.rs +0 -767
  234. package/dist/create/server-source/crates/feltdb/tests/semantic_query_contract.rs +0 -363
  235. package/dist/create/server-source/crates/feltdb/tests/state_conflict_contract_conformance.rs +0 -1799
  236. package/dist/create/server-source/crates/feltdb/tests/state_diff_contract_conformance.rs +0 -1316
  237. package/dist/create/server-source/crates/feltdb/tests/state_model_integration.rs +0 -358
  238. package/dist/create/server-source/crates/feltdb/tests/state_persistence_integration.rs +0 -365
  239. package/dist/create/server-source/crates/feltdb/tests/state_ref_authority.rs +0 -918
  240. package/dist/create/server-source/crates/feltdb/tests/state_store_boundary_evidence.rs +0 -299
  241. package/dist/create/server-source/crates/feltdb/tests/storage_independent_versioned_object_substrate.rs +0 -328
  242. package/dist/create/server-source/crates/feltdb/tests/sync_divergence_evidence.rs +0 -255
  243. package/dist/create/server-source/crates/feltdb/tests/three_way_input_boundary_evidence.rs +0 -249
  244. package/dist/create/server-source/crates/feltdb/tests/trigger_contract_conformance.rs +0 -994
  245. package/dist/create/server-source/crates/feltdb/tests/workload_envelope_contract.rs +0 -484
  246. package/dist/studio-app/assets/feltdb_wasm_bg-TseJn2Ax.wasm +0 -0
  247. package/dist/studio-app/assets/index-1wd0uKua.js +0 -30
@@ -1,736 +0,0 @@
1
- //! Multi-Operation Atomicity (Production Gate P1)
2
- //!
3
- //! A transaction groups several operations and guarantees that a reader sees
4
- //! all of them or none of them — never a subset — across commit, crash,
5
- //! restart, replay, concurrent writers, and replication.
6
- //!
7
- //! # How the guarantee is obtained
8
- //!
9
- //! The durable log is the *only* source of truth for committed state. A
10
- //! transaction becomes durable when, and only when, its complete record has
11
- //! been written and fsynced as a single log entry. Observable state is derived
12
- //! by replaying committed records.
13
- //!
14
- //! ```text
15
- //! transaction { A, B, C }
16
- //! |
17
- //! v
18
- //! preflight every precondition <- no state has been touched yet
19
- //! |
20
- //! v
21
- //! one record, one write, one fsync <- the atomic commit point
22
- //! |
23
- //! v
24
- //! apply A, B, C to derived state <- cannot fail; preflight proved it
25
- //! ```
26
- //!
27
- //! A crash before the fsync leaves no complete record, so recovery replays
28
- //! nothing. A crash after the fsync leaves a complete record, so recovery
29
- //! replays all of A, B, and C. A crash *during* the write leaves a torn tail,
30
- //! which is not a complete record and is discarded. There is no interleaving
31
- //! that produces a partial transaction, because partial application is never
32
- //! durable in the first place.
33
- //!
34
- //! Two properties do the real work:
35
- //!
36
- //! 1. **Preflight before commit.** Every precondition is evaluated against the
37
- //! current state before anything is written. A transaction that would fail
38
- //! part-way through is rejected before it can be committed, so the apply
39
- //! step after commit cannot fail.
40
- //! 2. **Integrity per record.** Each record carries a checksum over its body.
41
- //! A record that does not parse, or whose checksum does not match, was not
42
- //! completely written and therefore never committed.
43
- //!
44
- //! # Boundary
45
- //!
46
- //! This guarantee holds because derived state is rebuilt from the log. If a
47
- //! checkpointing layer is added later, it must checkpoint only at transaction
48
- //! boundaries; a checkpoint taken mid-apply would reintroduce exactly the
49
- //! partial-visibility problem this module removes.
50
-
51
- use crate::state_hash::CanonicalState;
52
- use serde::{Deserialize, Serialize};
53
- use serde_json::Value;
54
- use sha2::{Digest, Sha256};
55
- use std::collections::HashSet;
56
- use std::fs::{File, OpenOptions};
57
- use std::io::{BufRead, BufReader, Seek, SeekFrom, Write};
58
- use std::path::{Path, PathBuf};
59
-
60
- /// What a single operation does to one record.
61
- #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
62
- pub enum TransactionOp {
63
- /// Create or replace the record with this value.
64
- Set(Value),
65
- /// Remove the record.
66
- Delete,
67
- }
68
-
69
- /// A condition that must hold before the transaction is allowed to commit.
70
- #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
71
- pub enum Precondition {
72
- /// The record must currently exist.
73
- MustExist,
74
- /// The record must not currently exist.
75
- MustNotExist,
76
- /// The record must currently hold exactly this value.
77
- ValueEquals(Value),
78
- }
79
-
80
- /// One operation within a transaction.
81
- #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
82
- pub struct TransactionOperation {
83
- pub collection: String,
84
- pub record_id: String,
85
- pub op: TransactionOp,
86
- pub precondition: Option<Precondition>,
87
- }
88
-
89
- impl TransactionOperation {
90
- pub fn set(collection: &str, record_id: &str, value: Value) -> Self {
91
- Self {
92
- collection: collection.to_string(),
93
- record_id: record_id.to_string(),
94
- op: TransactionOp::Set(value),
95
- precondition: None,
96
- }
97
- }
98
-
99
- pub fn delete(collection: &str, record_id: &str) -> Self {
100
- Self {
101
- collection: collection.to_string(),
102
- record_id: record_id.to_string(),
103
- op: TransactionOp::Delete,
104
- precondition: None,
105
- }
106
- }
107
-
108
- pub fn requiring(mut self, precondition: Precondition) -> Self {
109
- self.precondition = Some(precondition);
110
- self
111
- }
112
-
113
- fn key(&self) -> (String, String) {
114
- (self.collection.clone(), self.record_id.clone())
115
- }
116
- }
117
-
118
- /// The durable unit of atomicity.
119
- ///
120
- /// A record is committed if and only if it appears in the log completely and
121
- /// its checksum verifies. Identity is `transaction_id`, which is what makes
122
- /// replay idempotent across restart and replication.
123
- #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
124
- pub struct TransactionRecord {
125
- pub transaction_id: String,
126
- pub node_id: String,
127
- pub sequence: u64,
128
- pub operations: Vec<TransactionOperation>,
129
- /// Checksum over the canonical body. Detects a partially written record.
130
- pub checksum: String,
131
- }
132
-
133
- impl TransactionRecord {
134
- pub fn new(
135
- transaction_id: &str,
136
- node_id: &str,
137
- sequence: u64,
138
- operations: Vec<TransactionOperation>,
139
- ) -> Self {
140
- let mut record = Self {
141
- transaction_id: transaction_id.to_string(),
142
- node_id: node_id.to_string(),
143
- sequence,
144
- operations,
145
- checksum: String::new(),
146
- };
147
- record.checksum = record.compute_checksum();
148
- record
149
- }
150
-
151
- fn compute_checksum(&self) -> String {
152
- // The checksum covers everything except itself, in a deterministic
153
- // encoding, so any truncation or mutation of the body is detectable.
154
- let body = serde_json::json!({
155
- "transaction_id": self.transaction_id,
156
- "node_id": self.node_id,
157
- "sequence": self.sequence,
158
- "operations": self.operations,
159
- });
160
- let mut hasher = Sha256::new();
161
- hasher.update(body.to_string().as_bytes());
162
- format!("{:x}", hasher.finalize())
163
- }
164
-
165
- /// Whether this record was written completely and has not been altered.
166
- pub fn verify_checksum(&self) -> bool {
167
- self.checksum == self.compute_checksum()
168
- }
169
-
170
- /// Records touched by this transaction, for conflict detection.
171
- pub fn touched_keys(&self) -> HashSet<(String, String)> {
172
- self.operations
173
- .iter()
174
- .map(|operation| operation.key())
175
- .collect()
176
- }
177
- }
178
-
179
- /// Why a transaction was refused. No state is modified in any of these cases.
180
- #[derive(Clone, Debug, PartialEq, Eq)]
181
- pub enum RejectionReason {
182
- /// A precondition did not hold. Carries the operation index and a reason.
183
- PreconditionFailed {
184
- operation_index: usize,
185
- detail: String,
186
- },
187
- /// The transaction contained no operations.
188
- Empty,
189
- /// The transaction writes the same record twice, so its outcome would
190
- /// depend on operation order rather than on the transaction as a whole.
191
- ConflictingWritesWithinTransaction {
192
- collection: String,
193
- record_id: String,
194
- },
195
- }
196
-
197
- /// The outcome of applying a record to derived state.
198
- #[derive(Clone, Debug, PartialEq, Eq)]
199
- pub enum ApplyOutcome {
200
- /// Every operation was applied.
201
- Applied,
202
- /// This transaction id was already applied; applying it again is a no-op.
203
- AlreadyApplied,
204
- /// Nothing was applied.
205
- Rejected(RejectionReason),
206
- }
207
-
208
- /// A log entry that could not be read.
209
- #[derive(Clone, Debug, PartialEq, Eq)]
210
- pub enum LogDefect {
211
- /// The final entry was incomplete: the process died while writing it.
212
- /// This transaction never committed and is discarded.
213
- TornTail { bytes: usize },
214
- /// An entry before the end is unreadable. This is corruption, not a torn
215
- /// write, and recovery refuses to guess.
216
- InteriorCorruption { line_number: usize, detail: String },
217
- }
218
-
219
- /// What recovery found in the log.
220
- #[derive(Clone, Debug)]
221
- pub struct RecoveryReport {
222
- pub committed: Vec<TransactionRecord>,
223
- /// Present when an incomplete final entry was discarded and truncated.
224
- pub discarded_tail: Option<LogDefect>,
225
- }
226
-
227
- /// Where to stop when simulating a crash. Used by the crash-injection harness.
228
- #[derive(Clone, Debug, PartialEq, Eq)]
229
- pub enum CrashPoint {
230
- /// Die before any byte reaches the log.
231
- BeforeWrite,
232
- /// Die having written only part of the record: a torn tail.
233
- DuringWrite { keep_percent: u8 },
234
- /// Die after the bytes were written but before fsync.
235
- AfterWriteBeforeFsync,
236
- /// Die after the record is durable but before it was applied to state.
237
- AfterFsyncBeforeApply,
238
- /// Die part-way through applying operations to in-memory state.
239
- DuringApply { after_operations: usize },
240
- /// Die after everything completed.
241
- AfterApply,
242
- }
243
-
244
- /// Append-only transaction log with per-record integrity.
245
- pub struct AtomicTransactionLog {
246
- path: PathBuf,
247
- file: File,
248
- }
249
-
250
- impl AtomicTransactionLog {
251
- /// Open a log, recovering it first.
252
- ///
253
- /// An incomplete final entry is truncated away before the log accepts new
254
- /// writes. Without this, the next append would splice onto a torn record
255
- /// and turn a recoverable tail into interior corruption.
256
- pub fn open<P: AsRef<Path>>(path: P) -> Result<(Self, RecoveryReport), std::io::Error> {
257
- let path = path.as_ref().to_path_buf();
258
- if let Some(parent) = path.parent() {
259
- std::fs::create_dir_all(parent)?;
260
- }
261
-
262
- let report = Self::read_log(&path)?;
263
- if let Some(LogDefect::TornTail { bytes }) = &report.discarded_tail {
264
- let file = OpenOptions::new().write(true).open(&path)?;
265
- let length = file.metadata()?.len();
266
- file.set_len(length.saturating_sub(*bytes as u64))?;
267
- file.sync_all()?;
268
- }
269
-
270
- let file = OpenOptions::new().create(true).append(true).open(&path)?;
271
- Ok((Self { path, file }, report))
272
- }
273
-
274
- /// Read the log without modifying it.
275
- pub fn read_log(path: &Path) -> Result<RecoveryReport, std::io::Error> {
276
- if !path.exists() {
277
- return Ok(RecoveryReport {
278
- committed: Vec::new(),
279
- discarded_tail: None,
280
- });
281
- }
282
-
283
- let reader = BufReader::new(File::open(path)?);
284
- let mut committed = Vec::new();
285
- let mut defect = None;
286
-
287
- // A line is only trustworthy once we know it is terminated, so entries
288
- // are collected with their raw bytes and the final one is judged last.
289
- let mut entries: Vec<(usize, String, bool)> = Vec::new();
290
- let mut buffer = Vec::new();
291
- let mut line_number = 0usize;
292
- let mut reader = reader;
293
- loop {
294
- buffer.clear();
295
- let read = reader.read_until(b'\n', &mut buffer)?;
296
- if read == 0 {
297
- break;
298
- }
299
- line_number += 1;
300
- let terminated = buffer.ends_with(b"\n");
301
- let text = String::from_utf8_lossy(&buffer)
302
- .trim_end_matches('\n')
303
- .to_string();
304
- entries.push((line_number, text, terminated));
305
- }
306
-
307
- let last_index = entries.len().saturating_sub(1);
308
- for (index, (number, text, terminated)) in entries.into_iter().enumerate() {
309
- if text.trim().is_empty() {
310
- continue;
311
- }
312
- let is_last = index == last_index;
313
- let parsed = serde_json::from_str::<TransactionRecord>(&text);
314
- let usable = match &parsed {
315
- Ok(record) => terminated && record.verify_checksum(),
316
- Err(_) => false,
317
- };
318
-
319
- if usable {
320
- committed.push(parsed.expect("checked above"));
321
- continue;
322
- }
323
-
324
- if is_last {
325
- // An unterminated, unparseable, or checksum-failing final entry
326
- // is a transaction that was still being written when the
327
- // process died. It never committed.
328
- defect = Some(LogDefect::TornTail {
329
- bytes: text.len() + usize::from(terminated),
330
- });
331
- } else {
332
- return Err(std::io::Error::new(
333
- std::io::ErrorKind::InvalidData,
334
- format!(
335
- "transaction log corrupted at line {}: {}",
336
- number,
337
- parsed
338
- .err()
339
- .map(|error| error.to_string())
340
- .unwrap_or_else(|| "checksum mismatch".to_string())
341
- ),
342
- ));
343
- }
344
- }
345
-
346
- Ok(RecoveryReport {
347
- committed,
348
- discarded_tail: defect,
349
- })
350
- }
351
-
352
- /// Commit a record: one write, one fsync. This is the atomic commit point.
353
- pub fn commit(&mut self, record: &TransactionRecord) -> Result<(), std::io::Error> {
354
- let json = serde_json::to_string(record)
355
- .map_err(|error| std::io::Error::new(std::io::ErrorKind::InvalidData, error))?;
356
- writeln!(self.file, "{}", json)?;
357
- self.file.sync_all()?;
358
- Ok(())
359
- }
360
-
361
- /// Commit while simulating a crash, for the crash-injection harness.
362
- ///
363
- /// Returns whether the record reached durable storage intact.
364
- pub fn commit_with_crash(
365
- &mut self,
366
- record: &TransactionRecord,
367
- crash: &CrashPoint,
368
- ) -> Result<bool, std::io::Error> {
369
- let json = serde_json::to_string(record)
370
- .map_err(|error| std::io::Error::new(std::io::ErrorKind::InvalidData, error))?;
371
-
372
- match crash {
373
- CrashPoint::BeforeWrite => Ok(false),
374
- CrashPoint::DuringWrite { keep_percent } => {
375
- // Write only part of the record and never terminate it: exactly
376
- // what a process death mid-write leaves behind.
377
- let cut = json.len() * (*keep_percent).min(99) as usize / 100;
378
- // Cut on a character boundary; the record is ASCII JSON, but a
379
- // value could carry multibyte text.
380
- let mut cut = cut.max(1).min(json.len().saturating_sub(1)).max(1);
381
- while cut > 1 && !json.is_char_boundary(cut) {
382
- cut -= 1;
383
- }
384
- let partial = &json[..cut];
385
- self.file.write_all(partial.as_bytes())?;
386
- self.file.sync_all()?;
387
- Ok(false)
388
- }
389
- CrashPoint::AfterWriteBeforeFsync => {
390
- writeln!(self.file, "{}", json)?;
391
- self.file.flush()?;
392
- // Deliberately no sync_all. The record is complete, so whether
393
- // it survives is the operating system's choice; either way it
394
- // is all-or-nothing, never partial.
395
- Ok(true)
396
- }
397
- _ => {
398
- writeln!(self.file, "{}", json)?;
399
- self.file.sync_all()?;
400
- Ok(true)
401
- }
402
- }
403
- }
404
-
405
- pub fn path(&self) -> &Path {
406
- &self.path
407
- }
408
-
409
- /// Bytes currently in the log, for harness assertions.
410
- pub fn size_bytes(&self) -> Result<u64, std::io::Error> {
411
- Ok(self.file.metadata()?.len())
412
- }
413
-
414
- /// Append raw bytes. Used only to simulate damage in tests.
415
- pub fn append_raw(&mut self, bytes: &[u8]) -> Result<(), std::io::Error> {
416
- self.file.write_all(bytes)?;
417
- self.file.sync_all()?;
418
- Ok(())
419
- }
420
-
421
- /// Overwrite bytes at an offset. Used only to simulate corruption in tests.
422
- pub fn corrupt_at(&mut self, offset: u64, bytes: &[u8]) -> Result<(), std::io::Error> {
423
- let mut file = OpenOptions::new().write(true).open(&self.path)?;
424
- file.seek(SeekFrom::Start(offset))?;
425
- file.write_all(bytes)?;
426
- file.sync_all()?;
427
- Ok(())
428
- }
429
- }
430
-
431
- /// Applies committed transactions to derived state.
432
- ///
433
- /// The executor never applies a transaction part-way. Preconditions are
434
- /// evaluated for every operation before any mutation is staged, and the staged
435
- /// mutations are then written together.
436
- pub struct TransactionExecutor {
437
- state: CanonicalState,
438
- applied: HashSet<String>,
439
- applied_order: Vec<String>,
440
- }
441
-
442
- impl TransactionExecutor {
443
- pub fn new() -> Self {
444
- Self {
445
- state: CanonicalState::new(),
446
- applied: HashSet::new(),
447
- applied_order: Vec::new(),
448
- }
449
- }
450
-
451
- pub fn state(&self) -> &CanonicalState {
452
- &self.state
453
- }
454
-
455
- pub fn applied_transactions(&self) -> &HashSet<String> {
456
- &self.applied
457
- }
458
-
459
- pub fn applied_order(&self) -> &[String] {
460
- &self.applied_order
461
- }
462
-
463
- /// Evaluate every precondition without mutating anything.
464
- ///
465
- /// This runs before the commit, which is what allows the post-commit apply
466
- /// to be infallible.
467
- pub fn preflight(&self, record: &TransactionRecord) -> Result<(), RejectionReason> {
468
- if record.operations.is_empty() {
469
- return Err(RejectionReason::Empty);
470
- }
471
-
472
- let mut seen: HashSet<(String, String)> = HashSet::new();
473
- for operation in &record.operations {
474
- if !seen.insert(operation.key()) {
475
- return Err(RejectionReason::ConflictingWritesWithinTransaction {
476
- collection: operation.collection.clone(),
477
- record_id: operation.record_id.clone(),
478
- });
479
- }
480
- }
481
-
482
- for (index, operation) in record.operations.iter().enumerate() {
483
- let Some(precondition) = &operation.precondition else {
484
- continue;
485
- };
486
- let current = self
487
- .state
488
- .get_record(&operation.collection, &operation.record_id);
489
- let failure = match (precondition, current) {
490
- (Precondition::MustExist, None) => Some("record does not exist".to_string()),
491
- (Precondition::MustNotExist, Some(_)) => Some("record already exists".to_string()),
492
- (Precondition::ValueEquals(expected), Some(actual)) if actual != expected => {
493
- Some("record does not hold the expected value".to_string())
494
- }
495
- (Precondition::ValueEquals(_), None) => Some("record does not exist".to_string()),
496
- _ => None,
497
- };
498
- if let Some(detail) = failure {
499
- return Err(RejectionReason::PreconditionFailed {
500
- operation_index: index,
501
- detail,
502
- });
503
- }
504
- }
505
-
506
- Ok(())
507
- }
508
-
509
- /// Apply a committed record. All operations, or none.
510
- pub fn apply(&mut self, record: &TransactionRecord) -> ApplyOutcome {
511
- if self.applied.contains(&record.transaction_id) {
512
- return ApplyOutcome::AlreadyApplied;
513
- }
514
- if let Err(reason) = self.preflight(record) {
515
- return ApplyOutcome::Rejected(reason);
516
- }
517
-
518
- // Preflight succeeded, so every mutation below is known to be legal.
519
- // Staging them first keeps the mutation phase free of any decision that
520
- // could fail half-way through.
521
- let staged: Vec<(&TransactionOperation, ())> = record
522
- .operations
523
- .iter()
524
- .map(|operation| (operation, ()))
525
- .collect();
526
- for (operation, ()) in staged {
527
- match &operation.op {
528
- TransactionOp::Set(value) => self.state.set_record(
529
- operation.collection.clone(),
530
- operation.record_id.clone(),
531
- value.clone(),
532
- ),
533
- TransactionOp::Delete => {
534
- self.state
535
- .records
536
- .remove(&(operation.collection.clone(), operation.record_id.clone()));
537
- }
538
- }
539
- }
540
-
541
- self.applied.insert(record.transaction_id.clone());
542
- self.applied_order.push(record.transaction_id.clone());
543
- ApplyOutcome::Applied
544
- }
545
-
546
- /// Rebuild state by replaying committed records in order.
547
- ///
548
- /// Replay is idempotent: a record already applied is skipped, so recovery
549
- /// can run repeatedly and converge on the same state.
550
- pub fn recover(&mut self, records: &[TransactionRecord]) -> Vec<ApplyOutcome> {
551
- records.iter().map(|record| self.apply(record)).collect()
552
- }
553
-
554
- /// Whether any operation of this transaction is visible in state.
555
- ///
556
- /// The atomicity assertion in the harness is that this is either all of
557
- /// them or none of them.
558
- pub fn visible_operations(&self, record: &TransactionRecord) -> usize {
559
- record
560
- .operations
561
- .iter()
562
- .filter(|operation| match &operation.op {
563
- TransactionOp::Set(value) => {
564
- self.state
565
- .get_record(&operation.collection, &operation.record_id)
566
- == Some(value)
567
- }
568
- TransactionOp::Delete => self
569
- .state
570
- .get_record(&operation.collection, &operation.record_id)
571
- .is_none(),
572
- })
573
- .count()
574
- }
575
- }
576
-
577
- impl Default for TransactionExecutor {
578
- fn default() -> Self {
579
- Self::new()
580
- }
581
- }
582
-
583
- /// A node that commits transactions durably and derives state from the log.
584
- ///
585
- /// This is the unit the crash harness kills and restarts.
586
- pub struct TransactionalNode {
587
- log: AtomicTransactionLog,
588
- executor: TransactionExecutor,
589
- node_id: String,
590
- next_sequence: u64,
591
- }
592
-
593
- impl TransactionalNode {
594
- /// Start a node, recovering derived state from the durable log.
595
- pub fn open<P: AsRef<Path>>(
596
- path: P,
597
- node_id: &str,
598
- ) -> Result<(Self, RecoveryReport), std::io::Error> {
599
- let (log, report) = AtomicTransactionLog::open(path)?;
600
- let mut executor = TransactionExecutor::new();
601
- executor.recover(&report.committed);
602
- let next_sequence = report
603
- .committed
604
- .iter()
605
- .map(|record| record.sequence)
606
- .max()
607
- .unwrap_or(0)
608
- + 1;
609
- Ok((
610
- Self {
611
- log,
612
- executor,
613
- node_id: node_id.to_string(),
614
- next_sequence,
615
- },
616
- report,
617
- ))
618
- }
619
-
620
- pub fn state(&self) -> &CanonicalState {
621
- self.executor.state()
622
- }
623
-
624
- pub fn executor(&self) -> &TransactionExecutor {
625
- &self.executor
626
- }
627
-
628
- pub fn log(&mut self) -> &mut AtomicTransactionLog {
629
- &mut self.log
630
- }
631
-
632
- pub fn build(
633
- &mut self,
634
- transaction_id: &str,
635
- operations: Vec<TransactionOperation>,
636
- ) -> TransactionRecord {
637
- let record = TransactionRecord::new(
638
- transaction_id,
639
- &self.node_id,
640
- self.next_sequence,
641
- operations,
642
- );
643
- self.next_sequence += 1;
644
- record
645
- }
646
-
647
- /// Commit a transaction: preflight, durably record, then apply.
648
- ///
649
- /// A rejected transaction is never written to the log, so a failed
650
- /// precondition leaves no trace in durable state.
651
- pub fn commit(&mut self, record: &TransactionRecord) -> Result<ApplyOutcome, std::io::Error> {
652
- if self
653
- .executor
654
- .applied_transactions()
655
- .contains(&record.transaction_id)
656
- {
657
- return Ok(ApplyOutcome::AlreadyApplied);
658
- }
659
- if let Err(reason) = self.executor.preflight(record) {
660
- return Ok(ApplyOutcome::Rejected(reason));
661
- }
662
- self.log.commit(record)?;
663
- Ok(self.executor.apply(record))
664
- }
665
-
666
- /// Commit while simulating a crash at the given point.
667
- ///
668
- /// Returns what the in-memory executor saw before the process "died". What
669
- /// matters is not this value but what a restarted node recovers.
670
- pub fn commit_with_crash(
671
- &mut self,
672
- record: &TransactionRecord,
673
- crash: &CrashPoint,
674
- ) -> Result<(), std::io::Error> {
675
- if self.executor.preflight(record).is_err() {
676
- return Ok(());
677
- }
678
- let durable = self.log.commit_with_crash(record, crash)?;
679
- if !durable {
680
- return Ok(());
681
- }
682
- match crash {
683
- CrashPoint::AfterFsyncBeforeApply => Ok(()),
684
- CrashPoint::DuringApply { after_operations } => {
685
- // Deliberately apply only a prefix, in memory, to model a
686
- // process that died mid-apply. This state is never persisted;
687
- // recovery rebuilds from the log.
688
- for operation in record.operations.iter().take(*after_operations) {
689
- if let TransactionOp::Set(value) = &operation.op {
690
- self.executor.state.set_record(
691
- operation.collection.clone(),
692
- operation.record_id.clone(),
693
- value.clone(),
694
- );
695
- }
696
- }
697
- Ok(())
698
- }
699
- _ => {
700
- self.executor.apply(record);
701
- Ok(())
702
- }
703
- }
704
- }
705
-
706
- /// Accept a transaction replicated from another node.
707
- ///
708
- /// Applying a replicated transaction is the same all-or-nothing path, and
709
- /// a transaction already applied here is ignored, so duplicate delivery is
710
- /// safe.
711
- pub fn accept_replicated(
712
- &mut self,
713
- record: &TransactionRecord,
714
- ) -> Result<ApplyOutcome, std::io::Error> {
715
- if !record.verify_checksum() {
716
- return Ok(ApplyOutcome::Rejected(
717
- RejectionReason::PreconditionFailed {
718
- operation_index: 0,
719
- detail: "replicated record failed its integrity check".to_string(),
720
- },
721
- ));
722
- }
723
- if self
724
- .executor
725
- .applied_transactions()
726
- .contains(&record.transaction_id)
727
- {
728
- return Ok(ApplyOutcome::AlreadyApplied);
729
- }
730
- if let Err(reason) = self.executor.preflight(record) {
731
- return Ok(ApplyOutcome::Rejected(reason));
732
- }
733
- self.log.commit(record)?;
734
- Ok(self.executor.apply(record))
735
- }
736
- }