Skip to main content

LocationFileStore

Trait LocationFileStore 

Source
pub trait LocationFileStore: Send + Sync {
    // Required methods
    fn upsert<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file: &'life1 LocationFile,
    ) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        file_id: &'life1 str,
        location_id: &'life2 LocationId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<LocationFile>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_by_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<LocationFile>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_by_location<'life0, 'life1, 'async_trait>(
        &'life0 self,
        location_id: &'life1 LocationId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<LocationFile>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_by_files<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        file_ids: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<LocationFile>>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        file_id: &'life1 str,
        location_id: &'life2 LocationId,
    ) -> Pin<Box<dyn Future<Output = Result<bool, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn count_by_location<'life0, 'life1, 'async_trait>(
        &'life0 self,
        location_id: &'life1 LocationId,
    ) -> Pin<Box<dyn Future<Output = Result<usize, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

LocationFile永続化。

(file_id, location_id) が一意キー。 file_idはTopologyFile.idに対応する。

Required Methods§

Source

fn upsert<'life0, 'life1, 'async_trait>( &'life0 self, file: &'life1 LocationFile, ) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

LocationFileを保存(新規 or 更新)。

(file_id, location_id) が既存ならUPDATE、なければINSERT。

Source

fn get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, file_id: &'life1 str, location_id: &'life2 LocationId, ) -> Pin<Box<dyn Future<Output = Result<Option<LocationFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

(file_id, location_id) でLocationFileを取得。

Source

fn list_by_file<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<LocationFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

あるファイルの全Location分のLocationFileを取得。

distribute_actions()の入力用: file_id → Vec

Source

fn list_by_location<'life0, 'life1, 'async_trait>( &'life0 self, location_id: &'life1 LocationId, ) -> Pin<Box<dyn Future<Output = Result<Vec<LocationFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

あるLocationの全LocationFileを取得。

スキャン時の比較用: location_id → Vec

Source

fn list_by_files<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, file_ids: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<LocationFile>>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

複数ファイルの全LocationFileを一括取得。

file_id → Vec のマップを返す。 distribute_actions()のバッチ入力用。N+1回避。

Source

fn delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, file_id: &'life1 str, location_id: &'life2 LocationId, ) -> Pin<Box<dyn Future<Output = Result<bool, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

LocationFileを削除。削除した場合true。

Source

fn count_by_location<'life0, 'life1, 'async_trait>( &'life0 self, location_id: &'life1 LocationId, ) -> Pin<Box<dyn Future<Output = Result<usize, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

あるLocationのLocationFile数。

Implementors§