The query consumer's cap applies to emitted bytes, not to raw change sizes. Both paths use the ordinary graph visibility and semantic rendering rules.
(
txn: &T,
changes: &C,
inode: Inode,
position: Position<NodeId>,
options: atomic_core::output::alive::RetrieveOptions,
max_bytes: usize,
)
| 1479 | /// The query consumer's cap applies to emitted bytes, not to raw change sizes. |
| 1480 | /// Both paths use the ordinary graph visibility and semantic rendering rules. |
| 1481 | pub(crate) fn retrieve_content_bounded<T, C>( |
| 1482 | txn: &T, |
| 1483 | changes: &C, |
| 1484 | inode: Inode, |
| 1485 | position: Position<NodeId>, |
| 1486 | options: atomic_core::output::alive::RetrieveOptions, |
| 1487 | max_bytes: usize, |
| 1488 | ) -> atomic_core::record::RecordResult<BoundedContent> |
| 1489 | where |
| 1490 | T: atomic_core::pristine::GraphTxnT |
| 1491 | + atomic_core::pristine::InodeGraphOps<InodeError = atomic_core::pristine::PristineError> |
| 1492 | + atomic_core::pristine::TreeTxnT, |
| 1493 | C: atomic_core::change::ChangeStore, |
| 1494 | { |
| 1495 | if let Some(content) = |
| 1496 | try_retrieve_linear_content_bounded(txn, changes, inode, position, &options, max_bytes)? |
| 1497 | { |
| 1498 | return Ok(content); |
| 1499 | } |
| 1500 | let result = match atomic_core::pristine::InodeScopedGraph::new(txn, inode) { |
| 1501 | Ok(scoped) => atomic_core::output::repo::output_file_to_buffer_bounded( |
| 1502 | &scoped, changes, position, options, max_bytes, |
| 1503 | ), |
| 1504 | Err(_) => atomic_core::output::repo::output_file_to_buffer_bounded( |
| 1505 | txn, changes, position, options, max_bytes, |
| 1506 | ), |
| 1507 | } |
| 1508 | .map_err(|error| { |
| 1509 | atomic_core::record::RecordError::Io(std::io::Error::other(error.to_string())) |
| 1510 | })?; |
| 1511 | Ok(match result.content { |
| 1512 | Some(bytes) => BoundedContent::Complete(bytes), |
| 1513 | None => BoundedContent::Oversized { |
| 1514 | retained_bytes: result.buffer_high_water, |
| 1515 | }, |
| 1516 | }) |
| 1517 | } |
| 1518 | |
| 1519 | fn try_retrieve_linear_content_bounded<T, C>( |
| 1520 | txn: &T, |