You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type: architectural-change Difficulty: Medium Recommendation: Adopt
Continuation of the state_store refactor series beyond what issue #168 tracked (upstream #1981–#1991). PR #2010 removes ReadTxn from the public AppStore API entirely. Read methods now come in two flavors:
*_in_txn(wtxn, ...) — for reads inside a write transaction (sees uncommitted writes)
xxx(...) — standalone reads that open their own internal snapshot
Storage::read_txn, read_txn_for_inspect, Environment::read_txn, and the ReadTxn/AnyTxn types are removed from the public surface. AppStore now carries a clone of the parent Env to support standalone reads. The MDB_READERS_FULL two-phase retry moves from Storage into AppStore standalone reads. spawn_iter_stable_paths_with_node_type is migrated from std::thread::spawn to tokio::task::spawn_blocking (the LMDB cursor is !Send so it still cannot cross .await, but the expression is idiomatic).
Call sites pattern change: let mut rtxn = env.read_txn().await?; app_store.read_x(&mut rtxn, ...) → app_store.read_x(...) (standalone); in-write-txn callers use app_store.read_x_in_txn(wtxn, ...)
No Python code to exclude; no feature-gating required
The tokio::task::spawn_blocking migration for spawn_iter_stable_paths_with_node_type is a correctness improvement for async contexts
Integration Notes
This is a direct continuation of #168's state_store series. Block this issue on #168 being resolved first. The core change is an API simplification that hides transaction management from callers — conceptually straightforward but touches many call sites. The !Send cursor constraint means the spawn_blocking migration needs special care; the upstream uses RoPrefix which wraps a raw *mut MDB_cursor.
Upstream Change Summary
Type: architectural-change
Difficulty: Medium
Recommendation: Adopt
Continuation of the state_store refactor series beyond what issue #168 tracked (upstream #1981–#1991). PR #2010 removes
ReadTxnfrom the publicAppStoreAPI entirely. Read methods now come in two flavors:*_in_txn(wtxn, ...)— for reads inside a write transaction (sees uncommitted writes)xxx(...)— standalone reads that open their own internal snapshotStorage::read_txn,read_txn_for_inspect,Environment::read_txn, and theReadTxn/AnyTxntypes are removed from the public surface.AppStorenow carries a clone of the parentEnvto support standalone reads. TheMDB_READERS_FULLtwo-phase retry moves fromStorageintoAppStorestandalone reads.spawn_iter_stable_paths_with_node_typeis migrated fromstd::thread::spawntotokio::task::spawn_blocking(the LMDB cursor is!Sendso it still cannot cross.await, but the expression is idiomatic).Upstream References
Relevant Upstream Files / Areas
rust/cocoindex/src/state_store/—AppStore,Storage,ReadTxn,AnyTxn,storage.rsrust/cocoindex/src/engine/— all call sites migrated fromenv.read_txn()patternRecoco Considerations
crates/recoco-core/src/state_store/,crates/recoco-core/src/engine/let mut rtxn = env.read_txn().await?; app_store.read_x(&mut rtxn, ...)→app_store.read_x(...)(standalone); in-write-txn callers useapp_store.read_x_in_txn(wtxn, ...)tokio::task::spawn_blockingmigration forspawn_iter_stable_paths_with_node_typeis a correctness improvement for async contextsIntegration Notes
This is a direct continuation of #168's state_store series. Block this issue on #168 being resolved first. The core change is an API simplification that hides transaction management from callers — conceptually straightforward but touches many call sites. The
!Sendcursor constraint means thespawn_blockingmigration needs special care; the upstream usesRoPrefixwhich wraps a raw*mut MDB_cursor.