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])
| 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 | /// |