Skip to main content

relay_knowledge/storage/contracts/code/
projection.rs

1use crate::domain::{CodeIndexPublicationFence, SoftwareGlobalProjection, SoftwareGlobalRequest};
2
3use super::super::{StorageError, StorageFuture};
4
5/// Software graph projection refresh and snapshot read capability.
6pub trait SoftwareProjectionStore: Send + Sync {
7    fn refresh_software_global_projection(
8        &self,
9        source_scope: String,
10    ) -> StorageFuture<'_, SoftwareGlobalProjection> {
11        Box::pin(async move {
12            Err(StorageError::InvalidInput(format!(
13                "software global projection for source scope '{source_scope}' is unavailable"
14            )))
15        })
16    }
17
18    fn refresh_software_global_projection_with_fence(
19        &self,
20        source_scope: String,
21        fence: CodeIndexPublicationFence,
22    ) -> StorageFuture<'_, SoftwareGlobalProjection> {
23        Box::pin(async move {
24            Err(StorageError::InvalidInput(format!(
25                "attempt-scoped software projection for task '{}' scope '{}' is unavailable",
26                fence.task_id, source_scope
27            )))
28        })
29    }
30
31    fn software_global_projection(
32        &self,
33        request: SoftwareGlobalRequest,
34    ) -> StorageFuture<'_, SoftwareGlobalProjection> {
35        Box::pin(async move {
36            Err(StorageError::InvalidInput(format!(
37                "software global projection for repository '{}' is unavailable",
38                request.repository.repository
39            )))
40        })
41    }
42
43    fn software_global_projection_for_scope(
44        &self,
45        source_scope: String,
46        _request: SoftwareGlobalRequest,
47    ) -> StorageFuture<'_, SoftwareGlobalProjection> {
48        Box::pin(async move {
49            Err(StorageError::InvalidInput(format!(
50                "software global projection for source scope '{source_scope}' is unavailable"
51            )))
52        })
53    }
54}