Skip to main content

SdkImplBuilder

Struct SdkImplBuilder 

Source
pub struct SdkImplBuilder { /* private fields */ }
Expand description

SdkImplのビルダー。

Location(拠点)を location() で登録し、ルートを connect() で宣言する。 Location からスキャナーが自動導出され、ルートコストは LocationKind の 組み合わせから自動推定される。

§使用例

let sdk = SdkImplBuilder::new(topology_files, location_files, transfer_store)
    .location(Arc::new(LocalLocation::new(root, hasher)))
    .location(Arc::new(SshLocation::new(pod_id, pod_root, shell)))
    .location(Arc::new(CloudLocation::new(cloud_id, cloud_root, backend)))
    .connect(&local_id, &cloud_id, rclone_backend)
    .connect_with_shell(&pod_id, &cloud_id, pod_rclone, pod_shell)
    .connect_pull(&cloud_id, &local_id, rclone_pull)
    .exclude(".git")
    .build()?;

Implementations§

Source§

impl SdkImplBuilder

Source

pub fn new( topology_files: Arc<dyn TopologyFileStore>, location_files: Arc<dyn LocationFileStore>, transfer_store: Arc<dyn TransferStore>, ) -> Self

必須3ストアでビルダーを作成。

Source

pub fn archive_route_to(self, dest: &LocationId, archive_root: PathBuf) -> Self

Enable archive-on-delete for routes targeting dest.

All routes whose destination is dest will move deleted files to {archive_root}/{ISO8601_ts}/{relative_path} instead of hard-deleting. The backend must implement archive_move (e.g. RcloneBackend via rclone moveto).

Source

pub fn location(self, loc: Arc<dyn Location>) -> Self

Location(拠点)追加。

Location trait 実装からスキャナーが自動導出される。 同じLocationIdの二重登録は無視される。

Source

pub fn connect( self, src: &LocationId, dest: &LocationId, backend: Box<dyn StorageBackend>, ) -> Self

Push方向のルート接続を宣言。

srcdest への転送ルートを登録する。 file_rootbuild() 時に Location から自動解決される。 コストは LocationKind の組み合わせから自動推定される。

Source

pub fn connect_with_shell( self, src: &LocationId, dest: &LocationId, backend: Box<dyn StorageBackend>, src_shell: Box<dyn RemoteShell>, ) -> Self

Push方向 + ソース側Shell付きのルート接続。

リモートホスト(Pod等)がソースの場合、ソース側でのファイル操作 (存在確認、ハッシュ計算)に src_shell を使用する。

Source

pub fn connect_pull( self, src: &LocationId, dest: &LocationId, backend: Box<dyn StorageBackend>, ) -> Self

Pull方向のルート接続。

Cloud → Local, Cloud → Pod のように、リモートからローカル方向への 転送ルートを登録する。backend.pull() が使用される。

Source

pub fn config(self, config: SyncConfig) -> Self

SyncConfig設定。

Source

pub fn exclude(self, pattern: &str) -> Self

スキャン除外パターン追加。

Source

pub fn build(self) -> Result<SdkImpl, SyncError>

SdkImplを構築。

  1. Location から Scanner を自動導出
  2. PendingRoute → TransferRoute に変換(file_root 自動解決 + コスト自動推定)
  3. TransferRoute から RouteGraph + TransferEngine を構築
  4. TopologyStore + TopologyScanner を構築

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more