Skip to content

Commit 019ef8c

Browse files
committed
refactor(engine): make StrictEngine, ColumnarEngine, and HtapBridge interior-mutable
Replaces outer `Mutex<Engine>` wrappers with per-engine interior locking: - `StrictEngine` is natively `Send + Sync`; all public methods take `&self` - `ColumnarEngine` moves to `RwLock<CollectionMap>` with per-collection `Mutex<CollectionState>` so concurrent reads on different collections do not block each other - `HtapBridge` wraps its view map in a `Mutex` and exposes `&self` methods - `RedbStorage` wraps `Database` in `Arc<Mutex<_>>` so async methods can move a cheap clone into `spawn_blocking` closures All call sites in `NodeDbLite`, the query DDL layer, the sync transport, and integration tests are updated to drop the outer `.lock()` calls and await engine futures directly, eliminating `block_in_place` workarounds throughout the codebase.
1 parent 798445a commit 019ef8c

32 files changed

Lines changed: 1203 additions & 1290 deletions

nodedb-lite/examples/live_sync.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ async fn test_delta_push() -> Result<(), String> {
147147
peer_id: 42,
148148
mutation_id: 1,
149149
checksum: 0,
150+
device_valid_time_ms: None,
150151
};
151152
ws.send(Message::Binary(
152153
SyncFrame::encode_or_empty(SyncMessageType::DeltaPush, &delta)
@@ -321,6 +322,7 @@ async fn test_real_loro_delta() -> Result<(), String> {
321322
peer_id: 100,
322323
mutation_id: 1,
323324
checksum: 0,
325+
device_valid_time_ms: None,
324326
};
325327
ws.send(Message::Binary(
326328
SyncFrame::encode_or_empty(SyncMessageType::DeltaPush, &delta_msg)
@@ -384,6 +386,7 @@ async fn test_concurrent_deltas() -> Result<(), String> {
384386
peer_id: 200 + i as u64 + 1,
385387
mutation_id: i as u64 + 1,
386388
checksum: 0,
389+
device_valid_time_ms: None,
387390
};
388391
ws.send(Message::Binary(
389392
SyncFrame::encode_or_empty(SyncMessageType::DeltaPush, &msg)
@@ -433,6 +436,7 @@ async fn test_rls_violation() -> Result<(), String> {
433436
peer_id: 500,
434437
mutation_id: 99,
435438
checksum: 0,
439+
device_valid_time_ms: None,
436440
};
437441
ws.send(Message::Binary(
438442
SyncFrame::encode_or_empty(SyncMessageType::DeltaPush, &msg)
@@ -481,6 +485,7 @@ async fn test_shape_snapshot_lsn() -> Result<(), String> {
481485
peer_id: 300,
482486
mutation_id: 1,
483487
checksum: 0,
488+
device_valid_time_ms: None,
484489
};
485490
ws.send(Message::Binary(
486491
SyncFrame::encode_or_empty(SyncMessageType::DeltaPush, &msg)

nodedb-lite/examples/load_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ async fn run_client(
172172
peer_id: 1000 + id as u64,
173173
mutation_id: 1,
174174
checksum: 0,
175+
device_valid_time_ms: None,
175176
};
176177
if ws
177178
.send(Message::Binary(

0 commit comments

Comments
 (0)