MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / search_content_plan

Method search_content_plan

atomic-repository/src/repository/query.rs:97–137  ·  view source on GitHub ↗
(
        &self,
        plan: RecordedContentSearch,
    )

Source from the content-addressed store, hash-verified

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
140impl Repository {

Callers 2

vault_kg_search_innerMethod · 0.80
search_contentMethod · 0.80

Calls 7

retrieve_content_boundedFunction · 0.85
retrievedFunction · 0.85
runMethod · 0.45
with_graph_visibilityMethod · 0.45
cloneMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected