@backblaze-labs/b2-sdk - v0.2.0
    Preparing search index...

    Interface ActionFactory

    Factory for creating concrete sync actions. Used by generateActions to decouple policy from execution.

    interface ActionFactory {
        copy(source: B2SyncPath, destRelativePath: string): SyncAction;
        copyB2Path?(source: B2SyncPath, dest: B2SyncPath): SyncAction;
        deleteLocal(path: LocalSyncPath): SyncAction;
        deleteRemote(path: B2SyncPath): SyncAction;
        download(
            source: B2SyncPath,
            scannedDest?: LocalSyncPath | null,
        ): SyncAction;
        hide(path: string): SyncAction;
        hideB2Path?(path: B2SyncPath): SyncAction;
        removeOrphan(dest: B2SyncPath): SyncAction;
        upload(source: LocalSyncPath, dest?: B2SyncPath): SyncAction;
    }
    Index

    Methods

    • Creates an action to server-side copy a B2 file to a sync-relative destination path. Kept for compatibility with custom factories that accept a sync-relative string.

      Parameters

      Returns SyncAction

    • Creates an action to download a B2 file to the local filesystem.

      generateActions passes null when the B2 source has no scanned local destination, a LocalSyncPath when the download replaces an existing scanned destination file, and leaves the value undefined only for callers that invoke a factory without destination scan context.

      Parameters

      Returns SyncAction

    • Creates an action to hide a file in B2 (soft delete). Kept for compatibility with custom factories that accept a sync-relative string.

      Parameters

      • path: string

      Returns SyncAction

    • Creates an action to hide a B2 file using its full scanned path metadata. Implementations can use selectedVersion.fileName when a raw B2 prefix or normalized sync path differs from the stored object key.

      Parameters

      Returns SyncAction

    • Creates the right "remove this orphan from B2" action for the bucket's configuration: a hide on a file-lock-enabled bucket (where direct delete may be blocked or stack hide markers), a plain delete-file-version on a vanilla bucket. Used by actionsForDestOnly to avoid yielding both a hide AND a delete when only one of them is the correct semantic for the destination bucket.

      Parameters

      Returns SyncAction