Get file content using the CRDT-driven walker (task #24). Walks the `Trunk → Branch` chain in file order and fetches each alive branch's bytes from its recorded `BRANCH_VERTEX` span. This bypasses the byte-graph linear walker entirely. # When to use Use this when you want the *materialized* file content — the state after all applied changes — without filtering by view. This is correct for sin
(
&self,
path: P,
)
| 133 | /// for this file (legacy repos that predate CRDT population) or when |
| 134 | /// any alive branch lacks a `BRANCH_VERTEX` mapping. |
| 135 | pub fn get_file_content_via_crdt<P: AsRef<Path>>( |
| 136 | &self, |
| 137 | path: P, |
| 138 | ) -> Result<Option<Vec<u8>>, RepositoryError> { |
| 139 | use atomic_core::output::crdt::{output_file_via_crdt, CrdtOutputError}; |
| 140 | |
| 141 | let path = path.as_ref(); |
| 142 | let normalized = normalize_path(path); |
| 143 | |
| 144 | let txn = self |
| 145 | .pristine |
| 146 | .read_txn() |
| 147 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 148 | |
| 149 | match output_file_via_crdt(&txn, &self.change_store, &normalized) { |
| 150 | Ok(content) if !content.is_empty() => Ok(Some(content)), |
| 151 | Ok(_) => { |
| 152 | // Empty result — file not in CRDT layer. Fall back to the |
| 153 | // view-scoped byte-graph walker. |
| 154 | drop(txn); |
| 155 | self.get_file_content(path) |
| 156 | } |
| 157 | Err(CrdtOutputError::OrphanBranch(_)) => { |
| 158 | // Alive branch without BRANCH_VERTEX — pre-walker data. |
| 159 | // Fall back to byte-graph walker. |
| 160 | drop(txn); |
| 161 | self.get_file_content(path) |
| 162 | } |
| 163 | Err(CrdtOutputError::Pristine(e)) => Err(RepositoryError::Database(e.to_string())), |
| 164 | Err(CrdtOutputError::Store(e)) => Err(RepositoryError::Database(e.to_string())), |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | /// Get file content, excluding a specific change. |
| 169 | /// |