vdsl_sync/infra/
location_file_store.rs1use async_trait::async_trait;
7
8use crate::domain::location::LocationId;
9use crate::domain::location_file::LocationFile;
10use crate::infra::error::InfraError;
11
12#[async_trait]
17pub trait LocationFileStore: Send + Sync {
18 async fn upsert(&self, file: &LocationFile) -> Result<(), InfraError>;
22
23 async fn get(
25 &self,
26 file_id: &str,
27 location_id: &LocationId,
28 ) -> Result<Option<LocationFile>, InfraError>;
29
30 async fn list_by_file(&self, file_id: &str) -> Result<Vec<LocationFile>, InfraError>;
34
35 async fn list_by_location(
39 &self,
40 location_id: &LocationId,
41 ) -> Result<Vec<LocationFile>, InfraError>;
42
43 async fn list_by_files(
48 &self,
49 file_ids: &[&str],
50 ) -> Result<std::collections::HashMap<String, Vec<LocationFile>>, InfraError>;
51
52 async fn delete(&self, file_id: &str, location_id: &LocationId) -> Result<bool, InfraError>;
54
55 async fn count_by_location(&self, location_id: &LocationId) -> Result<usize, InfraError>;
57}