relay_knowledge/storage/partitioned/
control_delegates.rs1use std::sync::Arc;
2
3use crate::{
4 domain::{
5 AuditEventRecord, CodeChunkRecord, CodeGraphBatch, CodeGraphCommitReceipt,
6 CodeReferenceRecord, CodeSymbolRecord, CommitReceipt, GraphMutationBatch, GraphVersion,
7 IndexKind, IndexStatus, ProposalState, RetrievalHit, ServiceOperatorStatus, WorkerStatus,
8 WorkerTaskRecord,
9 },
10 storage::{
11 AuditQueryRequest, CodeChunkSearchRequest, CodeGraphStore, CodeReferenceSearchRequest,
12 CodeRepositoryStore, CodeSymbolSearchRequest, FileIndexDiagnostics, FileIndexRoot,
13 FileIndexRootStatus, FileIndexRootUpdate, FileSearchHit, FileSearchRequest,
14 GraphCanvasStorageRequest, GraphCanvasStorageSnapshot, GraphInspection, GraphSearchRequest,
15 GraphStore, HealthStorageSnapshot, IndexCursor, IndexRefreshClaimRequest,
16 IndexRefreshCompletion, IndexRefreshDiagnostics, IndexRefreshFailure,
17 IndexRefreshQueueRequest, IndexRefreshTask, IndexStore, MutationLogEntry, MutationLogStore,
18 NewAuditEvent, NewProposal, ProposalDecision, ProposalListRequest, ServiceOperatorUpdate,
19 StorageFuture, WorkerTaskClaimRequest, WorkerTaskCompletion, WorkerTaskFailure,
20 WorkerTaskSeed,
21 },
22};
23
24use super::PartitionedSqliteKnowledgeStore;
25
26impl GraphStore for PartitionedSqliteKnowledgeStore {
27 fn commit_mutation_batch(&self, batch: GraphMutationBatch) -> StorageFuture<'_, CommitReceipt> {
28 self.control.commit_mutation_batch(batch)
29 }
30
31 fn inspect_graph(&self) -> StorageFuture<'_, GraphInspection> {
32 self.control.inspect_graph()
33 }
34
35 fn health_snapshot(&self, now_ms: u64) -> StorageFuture<'_, HealthStorageSnapshot> {
36 let control = Arc::clone(&self.control);
37 let this = self.clone();
38 Box::pin(async move {
39 let mut snapshot = control.health_snapshot(now_ms).await?;
40 snapshot.repository_code_totals = this.code_repository_totals().await?;
41 Ok(snapshot)
42 })
43 }
44
45 fn graph_canvas(
46 &self,
47 request: GraphCanvasStorageRequest,
48 ) -> StorageFuture<'_, GraphCanvasStorageSnapshot> {
49 self.control.graph_canvas(request)
50 }
51
52 fn search(&self, request: GraphSearchRequest) -> StorageFuture<'_, Vec<RetrievalHit>> {
53 self.control.search(request)
54 }
55
56 fn current_graph_version(&self) -> StorageFuture<'_, GraphVersion> {
57 self.control.current_graph_version()
58 }
59}
60
61impl MutationLogStore for PartitionedSqliteKnowledgeStore {
62 fn read_after(
63 &self,
64 graph_version: GraphVersion,
65 limit: usize,
66 ) -> StorageFuture<'_, Vec<MutationLogEntry>> {
67 self.control.read_after(graph_version, limit)
68 }
69}
70
71impl IndexStore for PartitionedSqliteKnowledgeStore {
72 fn index_statuses(&self) -> StorageFuture<'_, Vec<IndexStatus>> {
73 self.control.index_statuses()
74 }
75
76 fn mark_refresh_complete(
77 &self,
78 kind: IndexKind,
79 graph_version: GraphVersion,
80 ) -> StorageFuture<'_, IndexStatus> {
81 self.control.mark_refresh_complete(kind, graph_version)
82 }
83
84 fn index_cursors(&self) -> StorageFuture<'_, Vec<IndexCursor>> {
85 self.control.index_cursors()
86 }
87
88 fn queue_index_refreshes(
89 &self,
90 request: IndexRefreshQueueRequest,
91 ) -> StorageFuture<'_, IndexRefreshDiagnostics> {
92 self.control.queue_index_refreshes(request)
93 }
94
95 fn claim_index_refresh_task(
96 &self,
97 request: IndexRefreshClaimRequest,
98 ) -> StorageFuture<'_, Option<IndexRefreshTask>> {
99 self.control.claim_index_refresh_task(request)
100 }
101
102 fn complete_index_refresh_task(
103 &self,
104 request: IndexRefreshCompletion,
105 ) -> StorageFuture<'_, IndexRefreshTask> {
106 self.control.complete_index_refresh_task(request)
107 }
108
109 fn fail_index_refresh_task(
110 &self,
111 request: IndexRefreshFailure,
112 ) -> StorageFuture<'_, IndexRefreshTask> {
113 self.control.fail_index_refresh_task(request)
114 }
115
116 fn index_refresh_diagnostics(&self, now_ms: u64) -> StorageFuture<'_, IndexRefreshDiagnostics> {
117 self.control.index_refresh_diagnostics(now_ms)
118 }
119
120 fn queue_worker_tasks(
121 &self,
122 tasks: Vec<WorkerTaskSeed>,
123 ) -> StorageFuture<'_, Vec<WorkerTaskRecord>> {
124 self.control.queue_worker_tasks(tasks)
125 }
126
127 fn worker_statuses(&self) -> StorageFuture<'_, Vec<WorkerStatus>> {
128 self.control.worker_statuses()
129 }
130
131 fn claim_worker_task(
132 &self,
133 request: WorkerTaskClaimRequest,
134 ) -> StorageFuture<'_, Option<WorkerTaskRecord>> {
135 self.control.claim_worker_task(request)
136 }
137
138 fn complete_worker_task(
139 &self,
140 request: WorkerTaskCompletion,
141 ) -> StorageFuture<'_, WorkerTaskRecord> {
142 self.control.complete_worker_task(request)
143 }
144
145 fn fail_worker_task(&self, request: WorkerTaskFailure) -> StorageFuture<'_, WorkerTaskRecord> {
146 self.control.fail_worker_task(request)
147 }
148
149 fn insert_proposal(
150 &self,
151 proposal: NewProposal,
152 ) -> StorageFuture<'_, crate::domain::ProposalRecord> {
153 self.control.insert_proposal(proposal)
154 }
155
156 fn list_proposals(
157 &self,
158 request: ProposalListRequest,
159 ) -> StorageFuture<'_, Vec<crate::domain::ProposalRecord>> {
160 self.control.list_proposals(request)
161 }
162
163 fn proposal_count(&self, state: Option<ProposalState>) -> StorageFuture<'_, usize> {
164 self.control.proposal_count(state)
165 }
166
167 fn proposal_by_id(
168 &self,
169 proposal_id: String,
170 ) -> StorageFuture<'_, Option<crate::domain::ProposalRecord>> {
171 self.control.proposal_by_id(proposal_id)
172 }
173
174 fn proposal_conflicts(
175 &self,
176 proposal_id: String,
177 ) -> StorageFuture<'_, Vec<crate::domain::ProposalConflictRecord>> {
178 self.control.proposal_conflicts(proposal_id)
179 }
180
181 fn decide_proposal(
182 &self,
183 request: ProposalDecision,
184 ) -> StorageFuture<'_, crate::domain::ProposalRecord> {
185 self.control.decide_proposal(request)
186 }
187
188 fn insert_audit_event(&self, event: NewAuditEvent) -> StorageFuture<'_, AuditEventRecord> {
189 self.control.insert_audit_event(event)
190 }
191
192 fn query_audit_events(
193 &self,
194 request: AuditQueryRequest,
195 ) -> StorageFuture<'_, Vec<AuditEventRecord>> {
196 self.control.query_audit_events(request)
197 }
198
199 fn audit_event_count(&self) -> StorageFuture<'_, usize> {
200 self.control.audit_event_count()
201 }
202
203 fn service_operator_status(&self) -> StorageFuture<'_, ServiceOperatorStatus> {
204 self.control.service_operator_status()
205 }
206
207 fn update_service_operator(
208 &self,
209 request: ServiceOperatorUpdate,
210 ) -> StorageFuture<'_, ServiceOperatorStatus> {
211 self.control.update_service_operator(request)
212 }
213
214 fn replace_file_index_root(
215 &self,
216 update: FileIndexRootUpdate,
217 ) -> StorageFuture<'_, FileIndexRootStatus> {
218 self.control.replace_file_index_root(update)
219 }
220
221 fn mark_file_index_roots_unconfigured(
222 &self,
223 active_roots: Vec<FileIndexRoot>,
224 now_ms: u64,
225 ) -> StorageFuture<'_, FileIndexDiagnostics> {
226 self.control
227 .mark_file_index_roots_unconfigured(active_roots, now_ms)
228 }
229
230 fn search_files(&self, request: FileSearchRequest) -> StorageFuture<'_, Vec<FileSearchHit>> {
231 self.control.search_files(request)
232 }
233
234 fn file_index_diagnostics(&self) -> StorageFuture<'_, FileIndexDiagnostics> {
235 self.control.file_index_diagnostics()
236 }
237}
238
239impl CodeGraphStore for PartitionedSqliteKnowledgeStore {
240 fn commit_code_graph_batch(
241 &self,
242 batch: CodeGraphBatch,
243 ) -> StorageFuture<'_, CodeGraphCommitReceipt> {
244 self.control.commit_code_graph_batch(batch)
245 }
246
247 fn search_code_symbols(
248 &self,
249 request: CodeSymbolSearchRequest,
250 ) -> StorageFuture<'_, Vec<CodeSymbolRecord>> {
251 self.control.search_code_symbols(request)
252 }
253
254 fn search_code_references(
255 &self,
256 request: CodeReferenceSearchRequest,
257 ) -> StorageFuture<'_, Vec<CodeReferenceRecord>> {
258 self.control.search_code_references(request)
259 }
260
261 fn search_code_chunks(
262 &self,
263 request: CodeChunkSearchRequest,
264 ) -> StorageFuture<'_, Vec<CodeChunkRecord>> {
265 self.control.search_code_chunks(request)
266 }
267}