Check if a position has any content. This is a lighter-weight check than full retrieval, useful for quickly determining if a file exists in the graph. # Arguments `txn` - Transaction providing graph access `changes` - Change store for content retrieval `position` - Position to check # Returns `true` if the position has content vertices.
(txn: &T, changes: &C, position: Position<NodeId>)
| 277 | /// |
| 278 | /// `true` if the position has content vertices. |
| 279 | pub fn has_content<T, C>(txn: &T, changes: &C, position: Position<NodeId>) -> RecordResult<bool> |
| 280 | where |
| 281 | T: GraphTxnT, |
| 282 | C: ChangeStore, |
| 283 | { |
| 284 | if position == Position::ROOT { |
| 285 | return Ok(false); |
| 286 | } |
| 287 | |
| 288 | // Try to retrieve content - if we get anything, it has content |
| 289 | let opts = RetrieveContentOptions::new().max_vertices(1); |
| 290 | match retrieve_content_with_options(txn, changes, position, opts) { |
| 291 | Ok(result) => Ok(!result.is_empty()), |
| 292 | Err(RecordError::Pristine(e)) if matches!(*e, PristineError::BlockNotFound { .. }) => { |
| 293 | Ok(false) |
| 294 | } |
| 295 | Err(e) => Err(e), |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | // STATE-BASED CONTENT RETRIEVAL |
| 300 |