(snap: CsrSnapshotRkyv)
| 245 | /// Reconstruct CsrIndex from deserialized snapshot fields. |
| 246 | #[cfg(not(target_endian = "little"))] |
| 247 | fn from_snapshot_fields(snap: CsrSnapshotRkyv) -> Self { |
| 248 | let node_to_id: HashMap<String, u32> = snap |
| 249 | .nodes |
| 250 | .iter() |
| 251 | .enumerate() |
| 252 | .map(|(i, n)| (n.clone(), i as u32)) |
| 253 | .collect(); |
| 254 | let label_to_id: HashMap<String, u32> = snap |
| 255 | .labels |
| 256 | .iter() |
| 257 | .enumerate() |
| 258 | .map(|(i, l)| (l.clone(), i as u32)) |
| 259 | .collect(); |
| 260 | |
| 261 | let node_count = snap.nodes.len(); |
| 262 | let access_counts = (0..node_count).map(|_| std::cell::Cell::new(0)).collect(); |
| 263 | |
| 264 | let buffer_out_weights = if snap.buffer_out_weights.len() == node_count { |
| 265 | snap.buffer_out_weights |
| 266 | } else { |
| 267 | vec![Vec::new(); node_count] |
| 268 | }; |
| 269 | let buffer_in_weights = if snap.buffer_in_weights.len() == node_count { |
| 270 | snap.buffer_in_weights |
| 271 | } else { |
| 272 | vec![Vec::new(); node_count] |
| 273 | }; |
| 274 | |
| 275 | Self { |
| 276 | node_to_id, |
| 277 | id_to_node: snap.nodes, |
| 278 | label_to_id, |
| 279 | id_to_label: snap.labels, |
| 280 | out_offsets: snap.out_offsets, |
| 281 | out_targets: snap.out_targets.into(), |
| 282 | out_labels: snap.out_labels.into(), |
| 283 | out_weights: snap.out_weights.map(Into::into), |
| 284 | in_offsets: snap.in_offsets, |
| 285 | in_targets: snap.in_targets.into(), |
| 286 | in_labels: snap.in_labels.into(), |
| 287 | in_weights: snap.in_weights.map(Into::into), |
| 288 | buffer_out: snap.buffer_out, |
| 289 | buffer_in: snap.buffer_in, |
| 290 | buffer_out_weights, |
| 291 | buffer_in_weights, |
| 292 | deleted_edges: snap.deleted.into_iter().collect(), |
| 293 | has_weights: snap.has_weights, |
| 294 | node_label_bits: vec![0; node_count], |
| 295 | node_label_to_id: HashMap::new(), |
| 296 | node_label_names: Vec::new(), |
| 297 | // Surrogates are runtime-only and not persisted. After checkpoint |
| 298 | // restore they start at zero and are repopulated by subsequent EdgePuts. |
| 299 | node_surrogates: vec![0; node_count], |
| 300 | surrogate_to_local: HashMap::new(), |
| 301 | access_counts, |
| 302 | query_epoch: 0, |
| 303 | partition_tag: crate::csr::local_node_id::next_partition_tag(), |
| 304 | // Checkpoint restore creates an ungoverned index. |
nothing calls this directly
no test coverage detected