@feltdb/core 0.6.9 → 0.6.10

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 (98) hide show
  1. package/dist/cli/commands.js +189 -71
  2. package/dist/cli/index.js +1 -1
  3. package/dist/collection.d.ts +110 -2
  4. package/dist/collection.d.ts.map +1 -1
  5. package/dist/collection.js +228 -3
  6. package/dist/create/package-versions.js +1 -1
  7. package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +408 -178
  8. package/dist/create/server-source/crates/feltdb/src/lib.rs +49 -5
  9. package/dist/create/server-source/crates/feltdb/src/multi_operation_transaction.rs +659 -0
  10. package/dist/create/server-source/crates/feltdb/src/p1_application_atomicity.rs +285 -0
  11. package/dist/create/server-source/crates/feltdb/src/p1_atomicity_acceptance.rs +582 -0
  12. package/dist/create/server-source/crates/feltdb-server/src/main.rs +141 -0
  13. package/dist/db.d.ts +59 -0
  14. package/dist/db.d.ts.map +1 -1
  15. package/dist/db.js +94 -2
  16. package/dist/embedded-transaction.d.ts +77 -0
  17. package/dist/embedded-transaction.d.ts.map +1 -0
  18. package/dist/embedded-transaction.js +102 -0
  19. package/dist/feltdb.d.ts +49 -1
  20. package/dist/feltdb.d.ts.map +1 -1
  21. package/dist/file-db.d.ts +33 -0
  22. package/dist/file-db.d.ts.map +1 -1
  23. package/dist/file-db.js +128 -4
  24. package/dist/freshness.d.ts +119 -0
  25. package/dist/freshness.d.ts.map +1 -0
  26. package/dist/freshness.js +115 -0
  27. package/dist/http-db.d.ts +48 -0
  28. package/dist/http-db.d.ts.map +1 -1
  29. package/dist/http-db.js +77 -1
  30. package/dist/index-backend.d.ts +8 -0
  31. package/dist/index-backend.d.ts.map +1 -1
  32. package/dist/index-backend.js +13 -0
  33. package/dist/index-core.d.ts +78 -0
  34. package/dist/index-core.d.ts.map +1 -0
  35. package/dist/index-core.js +72 -0
  36. package/dist/index-manager.d.ts +11 -0
  37. package/dist/index-manager.d.ts.map +1 -1
  38. package/dist/index-manager.js +30 -13
  39. package/dist/index-types.d.ts +17 -0
  40. package/dist/index-types.d.ts.map +1 -1
  41. package/dist/index.browser.d.ts +14 -0
  42. package/dist/index.browser.d.ts.map +1 -0
  43. package/dist/index.browser.js +13 -0
  44. package/dist/index.d.ts +8 -59
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +11 -54
  47. package/dist/indexeddb-db.d.ts +32 -0
  48. package/dist/indexeddb-db.d.ts.map +1 -1
  49. package/dist/indexeddb-db.js +151 -1
  50. package/dist/memory-db.d.ts +26 -0
  51. package/dist/memory-db.d.ts.map +1 -1
  52. package/dist/memory-db.js +86 -0
  53. package/dist/runtime-registry.d.ts +32 -0
  54. package/dist/runtime-registry.d.ts.map +1 -0
  55. package/dist/runtime-registry.js +38 -0
  56. package/dist/studio-app/assets/{feltdb_wasm-B4wq4mqp.js → feltdb_wasm-CJv3wHzi.js} +1 -1
  57. package/dist/studio-app/assets/feltdb_wasm_bg-C8TG8r2n.wasm +0 -0
  58. package/dist/studio-app/assets/index-D3rT0SJi.js +28 -0
  59. package/dist/studio-app/index.html +1 -1
  60. package/dist/transaction.d.ts +98 -0
  61. package/dist/transaction.d.ts.map +1 -0
  62. package/dist/transaction.js +86 -0
  63. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  64. package/dist/workspace/browser.d.ts +22 -0
  65. package/dist/workspace/browser.d.ts.map +1 -0
  66. package/dist/workspace/browser.js +17 -0
  67. package/dist/workspace/git-identity.d.ts +35 -0
  68. package/dist/workspace/git-identity.d.ts.map +1 -0
  69. package/dist/workspace/git-identity.js +81 -0
  70. package/dist/workspace/index.d.ts +11 -1
  71. package/dist/workspace/index.d.ts.map +1 -1
  72. package/dist/workspace/index.js +6 -0
  73. package/dist/workspace/investigation-analysis.d.ts +47 -0
  74. package/dist/workspace/investigation-analysis.d.ts.map +1 -0
  75. package/dist/workspace/investigation-analysis.js +181 -0
  76. package/dist/workspace/investigation-lifecycle-manager.d.ts +86 -0
  77. package/dist/workspace/investigation-lifecycle-manager.d.ts.map +1 -0
  78. package/dist/workspace/investigation-lifecycle-manager.js +229 -0
  79. package/dist/workspace/investigation-supervisor.d.ts +100 -0
  80. package/dist/workspace/investigation-supervisor.d.ts.map +1 -0
  81. package/dist/workspace/investigation-supervisor.js +236 -0
  82. package/dist/workspace/runtime-investigation.d.ts +1 -1
  83. package/dist/workspace/runtime-investigation.d.ts.map +1 -1
  84. package/dist/workspace/runtime-investigation.js +46 -21
  85. package/dist/workspace/runtime-observation.d.ts +79 -0
  86. package/dist/workspace/runtime-observation.d.ts.map +1 -0
  87. package/dist/workspace/runtime-observation.js +152 -0
  88. package/dist/workspace/runtime-observer.d.ts +51 -0
  89. package/dist/workspace/runtime-observer.d.ts.map +1 -0
  90. package/dist/workspace/runtime-observer.js +268 -0
  91. package/dist/workspace/workspace-connection.d.ts.map +1 -1
  92. package/dist/workspace/workspace-connection.js +14 -5
  93. package/dist/workspace/workspace-types.d.ts +113 -0
  94. package/dist/workspace/workspace-types.d.ts.map +1 -1
  95. package/package.json +12 -4
  96. package/dist/create/server-source/crates/feltdb/src/phase_1c_three_node.rs +0 -523
  97. package/dist/studio-app/assets/feltdb_wasm_bg-Ceyi7l21.wasm +0 -0
  98. package/dist/studio-app/assets/index-BF45M757.js +0 -28
@@ -40,6 +40,9 @@ pub mod in_process_transport;
40
40
  pub mod tcp_transport;
41
41
  pub mod operation_algebra;
42
42
  pub mod crash_atomic_boundary;
43
+ pub mod multi_operation_transaction;
44
+ pub mod p1_atomicity_acceptance;
45
+ pub mod p1_application_atomicity;
43
46
  pub mod causal_dependency_barrier;
44
47
  pub mod partition_reconciliation;
45
48
  pub mod consistency_contract;
@@ -63,7 +66,6 @@ mod phase1c_atomicity_proof;
63
66
  #[cfg(test)]
64
67
  mod phase1c3_acceptance;
65
68
  #[cfg(test)]
66
- mod phase_1c_three_node;
67
69
  #[cfg(test)]
68
70
  mod phase_1c_real_tcp;
69
71
  #[cfg(test)]
@@ -2140,13 +2142,55 @@ where
2140
2142
  }
2141
2143
  }
2142
2144
 
2145
+ /// Read the log, separating a torn tail from real corruption.
2146
+ ///
2147
+ /// A process that dies while appending leaves a final record that was never
2148
+ /// terminated. That record was never committed, so recovery discards it and
2149
+ /// truncates it away: leaving the bytes in place would make the next append
2150
+ /// splice onto them and turn a normal crash into permanent corruption.
2151
+ ///
2152
+ /// Damage anywhere earlier is not an interrupted write. Recovery refuses it
2153
+ /// rather than silently dropping committed history.
2154
+ fn read_log_lines(path: &Path) -> Result<Vec<String>> {
2155
+ let mut file = BufReader::new(OpenOptions::new().read(true).open(path)?);
2156
+ let mut lines: Vec<(String, bool)> = Vec::new();
2157
+ let mut buffer = Vec::new();
2158
+ loop {
2159
+ buffer.clear();
2160
+ if file.read_until(b'\n', &mut buffer)? == 0 {
2161
+ break;
2162
+ }
2163
+ let terminated = buffer.ends_with(b"\n");
2164
+ let text = String::from_utf8_lossy(&buffer)
2165
+ .trim_end_matches('\n')
2166
+ .to_string();
2167
+ lines.push((text, terminated));
2168
+ }
2169
+
2170
+ let mut torn_bytes = 0usize;
2171
+ if let Some((text, terminated)) = lines.last() {
2172
+ let unusable = !*terminated || serde_json::from_str::<Value>(text).is_err();
2173
+ if unusable && !text.trim().is_empty() {
2174
+ torn_bytes = text.len() + usize::from(*terminated);
2175
+ lines.pop();
2176
+ }
2177
+ }
2178
+
2179
+ if torn_bytes > 0 {
2180
+ let file = OpenOptions::new().write(true).open(path)?;
2181
+ let length = file.metadata()?.len();
2182
+ file.set_len(length.saturating_sub(torn_bytes as u64))?;
2183
+ file.sync_all()?;
2184
+ }
2185
+
2186
+ Ok(lines.into_iter().map(|(text, _)| text).collect())
2187
+ }
2188
+
2143
2189
  fn replay_log(inner: &mut Inner) -> Result<()> {
2144
- let file = OpenOptions::new().read(true).open(&inner.path)?;
2145
- let reader = BufReader::new(file);
2190
+ let lines = read_log_lines(&inner.path)?;
2146
2191
 
2147
2192
  let mut snapshot_log = false;
2148
- for line in reader.lines() {
2149
- let line = line?;
2193
+ for line in lines {
2150
2194
  if line.trim().is_empty() {
2151
2195
  continue;
2152
2196
  }