Skip to main content

TopologyFileStore

Trait TopologyFileStore 

Source
pub trait TopologyFileStore: Send + Sync {
    // Required methods
    fn upsert<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file: &'life1 TopologyFile,
    ) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_by_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TopologyFile>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_by_path<'life0, 'life1, 'async_trait>(
        &'life0 self,
        relative_path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TopologyFile>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_canonical_hash<'life0, 'life1, 'async_trait>(
        &'life0 self,
        hash: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TopologyFile>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_active<'life0, 'async_trait>(
        &'life0 self,
        file_type: Option<FileType>,
        limit: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TopologyFile>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_deleted<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TopologyFile>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn hard_delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn count_active<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<usize, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_active_paths<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

TopologyFile永続化。

Topology上のファイル身元情報(canonical_hash, relative_path, file_type等)を管理する。 LocationFile(各Locationでの実体情報)は [LocationFileStore] が管理する。

Required Methods§

Source

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

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

idが既存の場合はUPDATE、なければINSERT。

Source

fn get_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<TopologyFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

IDでTopologyFileを取得。

Source

fn get_by_path<'life0, 'life1, 'async_trait>( &'life0 self, relative_path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<TopologyFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

relative_pathでTopologyFileを取得(deleted除外)。

Source

fn find_by_canonical_hash<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<TopologyFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

canonical_hashでTopologyFileを検索(deleted除外)。

rename検出で使用: スキャン結果のcontent_hashがTopologyFileのcanonical_hashに一致 すれば同一Entity。

Source

fn list_active<'life0, 'async_trait>( &'life0 self, file_type: Option<FileType>, limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TopologyFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

生存中(deleted_at IS NULL)のTopologyFile一覧。

Source

fn list_deleted<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<TopologyFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

削除済み(deleted_at IS NOT NULL)のTopologyFile一覧。

distribute_delete_actions()で使用: 削除済みファイルのLocationFileを掃除する。

Source

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

削除済みTFを物理削除。

全LocationFileのdelete transferが完了し、LFが0件になった後に呼ぶ。 B2 archived データは独立して残るため、restore_from_archiveで復元可能。

Source

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

生存中ファイル数。

Source

fn list_active_paths<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

全TopologyFileのrelative_path一覧(deleted除外)。

スキャン結果との差分でVanished検出に使用。

Implementors§