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

Method ensure_span_index

atomic-core/src/pristine/txn/read.rs:1943–1963  ·  view source on GitHub ↗

Load `change_id`'s spans into the in-memory index on first access.

(&self, change_id: u64)

Source from the content-addressed store, hash-verified

1941
1942 /// Load `change_id`'s spans into the in-memory index on first access.
1943 fn ensure_span_index(&self, change_id: u64) -> PristineResult<()> {
1944 if self.span_index.lock().unwrap().contains_change(change_id) {
1945 return Ok(());
1946 }
1947 let start_key = encode_vertex(change_id, 0, 0);
1948 let end_key = encode_vertex(change_id, u64::MAX, u64::MAX);
1949 let mut set = std::collections::BTreeSet::new();
1950 for result in self.graph_table.range::<&[u8; 24]>(&start_key..=&end_key)? {
1951 let (key, _values) = result?;
1952 let (v_change, v_start, v_end) = decode_vertex(key.value());
1953 if v_change != change_id {
1954 continue;
1955 }
1956 set.insert((v_start, v_end));
1957 }
1958 self.span_index
1959 .lock()
1960 .unwrap()
1961 .insert_change(change_id, set);
1962 Ok(())
1963 }
1964}
1965
1966impl PathClaimTxnT for CachedGraphTxn<'_> {

Callers 2

find_blockMethod · 0.80
find_block_endMethod · 0.80

Calls 8

encode_vertexFunction · 0.85
decode_vertexFunction · 0.85
contains_changeMethod · 0.80
lockMethod · 0.80
valueMethod · 0.80
unwrapMethod · 0.45
insertMethod · 0.45
insert_changeMethod · 0.45

Tested by

no test coverage detected