(
scope: &rayon::Scope<'scope>,
ctx: &'scope ExecutionContext<'a, 'scope, W>,
node: &'scope Node<'a>,
)
| 256 | /// It handles Serialization -> Compression -> Writing -> Notification. |
| 257 | #[cfg(all(feature = "parallel", not(target_arch = "wasm32")))] |
| 258 | fn process_node<'scope, 'a, W>( |
| 259 | scope: &rayon::Scope<'scope>, |
| 260 | ctx: &'scope ExecutionContext<'a, 'scope, W>, |
| 261 | node: &'scope Node<'a>, |
| 262 | ) where |
| 263 | W: Write + Send, |
| 264 | { |
| 265 | // 0. Fast abort check |
| 266 | if ctx.should_abort() { |
| 267 | return; |
| 268 | } |
| 269 | |
| 270 | // 1. Prepare data |
| 271 | |
| 272 | let completed_children_raw = { |
| 273 | let lock = node |
| 274 | .completed_children |
| 275 | .lock() |
| 276 | .map_err(|_| ParcodeError::Internal("Node mutex poisoned".into())); |
| 277 | match lock { |
| 278 | Ok(mut guard) => std::mem::take(&mut *guard), |
| 279 | Err(e) => { |
| 280 | ctx.signal_error(e); |
| 281 | return; |
| 282 | } |
| 283 | } |
| 284 | }; |
| 285 | |
| 286 | let children_refs: Vec<ChildRef> = match completed_children_raw |
| 287 | .into_iter() |
| 288 | .map(|opt| opt.ok_or_else(|| ParcodeError::Internal("Missing child result".into()))) |
| 289 | .collect() |
| 290 | { |
| 291 | Ok(v) => v, |
| 292 | Err(e) => { |
| 293 | ctx.signal_error(e); |
| 294 | return; |
| 295 | } |
| 296 | }; |
| 297 | |
| 298 | let is_chunkable = !children_refs.is_empty(); |
| 299 | |
| 300 | let raw_payload = match node.job.execute(&children_refs) { |
| 301 | Ok(bytes) => bytes, |
| 302 | Err(e) => { |
| 303 | ctx.signal_error(e); |
| 304 | return; |
| 305 | } |
| 306 | }; |
| 307 | |
| 308 | // 2&3. Compression and formatting |
| 309 | |
| 310 | let config = node.job.config(); |
| 311 | let compression_id = if ctx.use_compression && config.compression_id == 0 { |
| 312 | 1 |
| 313 | } else { |
| 314 | config.compression_id |
| 315 | }; |
no test coverage detected