Files
Termind/Frameworks/TermindRemoteInfrastructure/Transfers/SFTPDownloadStream.swift
T

22 lines
849 B
Swift

import Foundation
/// A checked regular-file handle. EOF proves the declared size and available
/// modification metadata still match; it does not promise an atomic snapshot.
public nonisolated protocol SFTPDownloadStream: Sendable {
var byteCount: Int64 { get }
var sourceIdentity: SFTPSourceIdentity? { get }
func seek(to offset: Int64) async throws
func readChunk() async throws -> Data?
func close() async throws
}
public nonisolated enum SFTPDownloadFailure: Error, Sendable {
case missingFile, unsupportedType, tooLarge, sourceChanged, invalidChunk, closeFailed, timedOut
case digestMismatch(actualSHA256: String)
}
nonisolated extension SFTPDownloadStream {
public var sourceIdentity: SFTPSourceIdentity? { nil }
public func seek(to offset: Int64) async throws { throw SFTPResumeFailure.unsupported }
}