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

Method load_graph_sections

atomic-repository/src/redb_change_store/queries.rs:93–124  ·  view source on GitHub ↗

Load all graph sections for a change. Reads from CHANGE_GRAPH only. This is the "thin apply" path — the minimum data needed to apply a change to the repository DAG. # Returns A vector of decompressed graph section payloads, ordered by file index.

(&self, hash: &[u8; 32])

Source from the content-addressed store, hash-verified

91 ///
92 /// A vector of decompressed graph section payloads, ordered by file index.
93 pub fn load_graph_sections(&self, hash: &[u8; 32]) -> RedbStoreResult<Vec<StoredSection>> {
94 let meta = self.load_meta(hash)?;
95 let txn = self.db().begin_read()?;
96 let table = txn.open_table(tables::CHANGE_GRAPH)?;
97
98 let mut sections = Vec::with_capacity(meta.graph_section_count as usize);
99
100 for idx in 0..meta.graph_section_count {
101 let key = tables::encode_change_file_key(hash, idx);
102 if let Some(value) = table.get(&key)? {
103 let compressed = value.value();
104 let decompressed = zstd::decode_all(compressed).map_err(|e| {
105 RedbStoreError::Corrupt(format!(
106 "graph section {} decompression failed: {}",
107 idx, e
108 ))
109 })?;
110
111 // Extract path from the payload (it's a postcard-encoded GraphSectionPayload)
112 let path = extract_path_from_payload(&decompressed);
113
114 sections.push(StoredSection {
115 section_type: SectionType::Graph,
116 payload: decompressed,
117 path,
118 file_index: idx,
119 });
120 }
121 }
122
123 Ok(sections)
124 }
125
126 /// Load all semantic sections for a change.
127 ///

Callers 3

regenerate_changeFunction · 0.80
test_load_graph_sectionsFunction · 0.80

Calls 7

encode_change_file_keyFunction · 0.85
load_metaMethod · 0.80
begin_readMethod · 0.80
dbMethod · 0.80
getMethod · 0.65
pushMethod · 0.45

Tested by 2

test_load_graph_sectionsFunction · 0.64