Skip to main content

Location

Trait Location 

Source
pub trait Location: Send + Sync {
    // Required methods
    fn id(&self) -> &LocationId;
    fn kind(&self) -> LocationKind;
    fn file_root(&self) -> &Path;
    fn scanner(&self) -> Arc<dyn LocationScanner> ;
    fn ensure<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

拠点の多態抽象。

各拠点は自分のスキャン方法を知っている:

  • Local: walkdir + ContentHasher
  • SSH: RemoteShell + batch_inspect
  • Cloud: StorageBackend.list() (metadata only)

Location trait 実装を SdkImplBuilder::location() に渡すことで、 Scanner と Route の整合性が保証される。 kind()SdkImplBuilder::build() でルートコストの自動推定に使用される。

Required Methods§

Source

fn id(&self) -> &LocationId

この拠点の識別子。

Source

fn kind(&self) -> LocationKind

拠点の物理的分類。

ルート間コスト推定に使用される。

Source

fn file_root(&self) -> &Path

ファイルのベースパス。

Local: /Users/.../output Pod: /workspace/comfyui/output Cloud: vdsl/output

Source

fn scanner(&self) -> Arc<dyn LocationScanner>

この拠点のスキャナーを返す。

各実装が自分のスキャン方法に応じたLocationScannerを構築して返す。

Source

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

拠点の到達可能性を検証し、必要な外部ツールを確保する。

sync開始前に全Locationに対して呼ばれる。

  • Local: file_rootの存在確認(なければ作成)
  • SSH: SSH接続テスト
  • Cloud: rcloneバイナリ確認 + バケット接続テスト

失敗時は早期エラーで、数分かかるscanを無駄にしない。

Implementors§