Skip to main content

relay_knowledge/storage/contracts/code/
retention.rs

1use crate::domain::CodeScopeRetentionSummary;
2
3use super::super::{StorageError, StorageFuture};
4use super::CodeScopeRetentionRequest;
5
6/// Scope and whole-repository retention planning and execution capability.
7pub trait CodeScopeRetentionStore: Send + Sync {
8    fn code_scope_retention(
9        &self,
10        repository_id: String,
11    ) -> StorageFuture<'_, CodeScopeRetentionSummary>;
12
13    fn prune_code_repository_scopes(
14        &self,
15        request: CodeScopeRetentionRequest,
16    ) -> StorageFuture<'_, CodeScopeRetentionSummary>;
17
18    fn schedule_code_repository_retention(
19        &self,
20        _max_indexed_repositories: usize,
21        _now_ms: u64,
22    ) -> StorageFuture<'_, Option<String>> {
23        Box::pin(async {
24            Err(StorageError::InvalidInput(
25                "code repository retention scheduling is unavailable".to_owned(),
26            ))
27        })
28    }
29
30    fn code_repository_retention_scan_pending(&self) -> StorageFuture<'_, bool> {
31        Box::pin(async {
32            Err(StorageError::InvalidInput(
33                "code repository retention scan status is unavailable".to_owned(),
34            ))
35        })
36    }
37}