(
&self,
plan: RecordedContentSearch,
)
| 95 | } |
| 96 | |
| 97 | pub fn search_content_plan( |
| 98 | &self, |
| 99 | plan: RecordedContentSearch, |
| 100 | ) -> Result<ContentSearchResult, RepositoryError> { |
| 101 | plan.run(|path| { |
| 102 | let (inode, position) = self.files[path]; |
| 103 | let rendered = match super::content::retrieve_span_bounded_if_present( |
| 104 | &self.txn, |
| 105 | &self.repo.change_store, |
| 106 | inode, |
| 107 | &self.visibility, |
| 108 | RECORDED_CONTENT_LIMIT, |
| 109 | )? { |
| 110 | Some(content) => content, |
| 111 | None => super::content::retrieve_content_bounded( |
| 112 | &self.txn, |
| 113 | &self.repo.change_store, |
| 114 | inode, |
| 115 | position, |
| 116 | atomic_core::output::alive::RetrieveOptions::new() |
| 117 | .with_graph_visibility(self.visibility.clone()), |
| 118 | RECORDED_CONTENT_LIMIT, |
| 119 | ) |
| 120 | .map_err(|error| RepositoryError::Database(error.to_string()))?, |
| 121 | }; |
| 122 | let (bytes, retained_bytes) = match rendered { |
| 123 | super::content::BoundedContent::Complete(bytes) => { |
| 124 | let retained = bytes.len(); |
| 125 | (Some(bytes), retained) |
| 126 | } |
| 127 | super::content::BoundedContent::Oversized { retained_bytes } => { |
| 128 | (None, retained_bytes) |
| 129 | } |
| 130 | }; |
| 131 | #[cfg(any(test, feature = "query-test-instrumentation"))] |
| 132 | crate::query_diagnostics::retrieved(retained_bytes); |
| 133 | #[cfg(not(any(test, feature = "query-test-instrumentation")))] |
| 134 | let _ = retained_bytes; |
| 135 | Ok(bytes) |
| 136 | }) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | impl Repository { |
no test coverage detected