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

Method load_graph_sections

atomic-repository/src/redb_change_store/queries.rs:92–123  ·  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

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

Callers 3

regenerate_changeFunction · 0.80
test_load_graph_sectionsFunction · 0.80

Calls 6

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

Tested by 2

test_load_graph_sectionsFunction · 0.64