pub async fn object_copy(
profile_id: ProfileId,
source: ObjectRef,
destination: ObjectRef,
options: CopyOptions,
confirmed_token: Option<String>,
store: State<'_, ProfileStoreHandle>,
pool: State<'_, S3ClientPoolHandle>,
locks: State<'_, LockRegistryHandle>,
cache: State<'_, CacheHandle>,
confirm_cache: State<'_, ConfirmationCacheHandle>,
channel: AppHandle,
) -> Result<CopyOutcome, AppError>Expand description
Copy source to destination with automatic cross-account fallback.
- Attempts server-side
CopyObjectfirst. - On
AccessDenied(cross-account scenario):- If the source size is ≤
fallback_threshold_bytes(default 100 MiB), falls back to download+upload automatically. - If the source size is above the threshold and
confirmed_tokenis a valid one-time token minted bycross_account_confirm, falls back. - Otherwise returns
AppError::Validationasking the frontend to callcross_account_confirmfirst.
- If the source size is ≤
- Returns
CopyOutcomeinstead ofCopyResultso the frontend can show a “Used fallback” indicator when the fallback path was taken. - Acquires scoped locks on source and destination prefixes before calling S3.
- Invalidates destination prefix cache and emits
objects:updatedon success. - Both locks are released (success or failure) before returning.