Cache side: replace graph rows and reconstruct canonical derived indexes. Hold the authenticated changes first, then import a slice covering every owner inode from [`Self::sandbox_slice_inodes`]. The complete closure is required for path/attribute projection; a thin content slice is insufficient.
(&self, slice: &SandboxSlice)
| 1204 | /// owner inode from [`Self::sandbox_slice_inodes`]. The complete closure is |
| 1205 | /// required for path/attribute projection; a thin content slice is insufficient. |
| 1206 | pub fn import_sandbox_slice(&self, slice: &SandboxSlice) -> Result<(), RepositoryError> { |
| 1207 | let view_id = { |
| 1208 | let txn = self.pristine.read_txn().map_err(db)?; |
| 1209 | txn.get_view(self.current_view()) |
| 1210 | .map_err(db)? |
| 1211 | .ok_or_else(|| RepositoryError::ViewNotFound { |
| 1212 | name: self.current_view().to_string(), |
| 1213 | })? |
| 1214 | .id |
| 1215 | }; |
| 1216 | let mut txn = self.pristine.write_txn().map_err(db)?; |
| 1217 | txn.import_graph_slice(&slice.rows, view_id).map_err(db)?; |
| 1218 | let view = txn |
| 1219 | .get_view(self.current_view()) |
| 1220 | .map_err(db)? |
| 1221 | .ok_or_else(|| RepositoryError::ViewNotFound { |
| 1222 | name: self.current_view().into(), |
| 1223 | })?; |
| 1224 | // A just-submitted change may already have its file in the cache but |
| 1225 | // only receive its owner's node id in the new skeleton. Index all |
| 1226 | // canonical dependencies even when no change download was necessary. |
| 1227 | let mut pending = super::view_membership(&txn, &view)? |
| 1228 | .iter() |
| 1229 | .copied() |
| 1230 | .collect::<Vec<_>>(); |
| 1231 | let mut indexed = std::collections::HashSet::new(); |
| 1232 | while let Some(id) = pending.pop() { |
| 1233 | if id.is_root() || !indexed.insert(id) { |
| 1234 | continue; |
| 1235 | } |
| 1236 | let hash = txn.get_external(id).map_err(db)?.ok_or_else(|| { |
| 1237 | RepositoryError::Database(format!("missing change hash for {id}")) |
| 1238 | })?; |
| 1239 | let change = self.load_change(&hash)?; |
| 1240 | for hash in change.dependencies() { |
| 1241 | pending.push(txn.get_internal(hash).map_err(db)?.ok_or_else(|| { |
| 1242 | RepositoryError::Database(format!("missing dependency {hash}")) |
| 1243 | })?); |
| 1244 | } |
| 1245 | txn.put_change_deps(id, change.dependencies()).map_err(db)?; |
| 1246 | } |
| 1247 | let closure = super::graph_visibility_closure(&txn, &view)?; |
| 1248 | let mut claims = Vec::new(); |
| 1249 | // Reconstruct derived indexes from authenticated canonical changes and |
| 1250 | // imported graph identities. TREE is never used as file history. |
| 1251 | for id in closure |
| 1252 | .iter_dependency_first() |
| 1253 | .copied() |
| 1254 | .filter(|id| !id.is_root()) |
| 1255 | { |
| 1256 | let hash = txn.get_external(id).map_err(db)?.ok_or_else(|| { |
| 1257 | RepositoryError::Database(format!("missing change hash for {id}")) |
| 1258 | })?; |
| 1259 | let change = self.load_change(&hash)?; |
| 1260 | claims.extend( |
| 1261 | super::name_resolution::path_claim_events_for_change_with_prior( |
| 1262 | &txn, id, &change, &claims, |
| 1263 | )?, |