MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / initialize

Function initialize

atomic-core/src/pristine/applied_changes.rs:20–35  ·  view source on GitHub ↗

One-time compatibility rebuild from persisted canonical effects and committed view logs. A registered/fetched object by itself is not evidence. The marker and recovered entries commit together, so an interrupted rebuild retries. No path ownership or recorded content is inferred from this index.

(txn: &redb::WriteTransaction)

Source from the content-addressed store, hash-verified

18/// The marker and recovered entries commit together, so an interrupted rebuild
19/// retries. No path ownership or recorded content is inferred from this index.
20pub(crate) fn initialize(txn: &redb::WriteTransaction) -> PristineResult<()> {
21 let mut index = txn.open_table(APPLIED_CHANGES)?;
22 let mut meta = txn.open_table(PRISTINE_META)?;
23 if meta.get(INDEX_VERSION_KEY)?.is_some() {
24 return Ok(());
25 }
26 for id in canonical_effect_writers(
27 &txn.open_multimap_table(GRAPH)?,
28 &txn.open_multimap_table(POSITION_ATTRS)?,
29 &txn.open_table(VIEW_CHANGES)?,
30 )? {
31 index.insert(id, 1)?;
32 }
33 meta.insert(INDEX_VERSION_KEY, 1)?;
34 Ok(())
35}
36
37fn canonical_effect_writers(
38 graph: &impl ReadableMultimapTable<&'static [u8; 24], &'static [u8; 24]>,

Callers 2

openMethod · 0.85

Calls 3

canonical_effect_writersFunction · 0.85
getMethod · 0.65
insertMethod · 0.45

Tested by

no test coverage detected