pub struct ImportJob { /* private fields */ }Expand description
Cold-construction import job with RAII scratch cleanup.
The caller’s raw_path is never opened for write. A copy (or same-volume
hardlink) lives under a unique TempDir; only that directory is cleaned
on drop / unwind — no broad temp sweeps.
Implementations§
Source§impl ImportJob
impl ImportJob
Sourcepub fn begin(
raw_path: &Path,
budgets: ImportBudgets,
) -> Result<Self, ImportError>
pub fn begin( raw_path: &Path, budgets: ImportBudgets, ) -> Result<Self, ImportError>
Begin a job: validate budgets, create unique TempDir, stage immutable raw.
Sourcepub fn scratch_path(&self) -> &Path
pub fn scratch_path(&self) -> &Path
Absolute path of this job’s TempDir (for tests / diagnostics only).
Sourcepub fn raw_scratch_path(&self) -> &Path
pub fn raw_scratch_path(&self) -> &Path
Path of the immutable staged raw copy inside scratch.
Sourcepub fn status(&self) -> &ImportStatus
pub fn status(&self) -> &ImportStatus
ImportJob::status.
Sourcepub fn quarantined(&self) -> u64
pub fn quarantined(&self) -> u64
Quarantined assets.
Sourcepub fn budgets(&self) -> ImportBudgets
pub fn budgets(&self) -> ImportBudgets
Import budgets.
Sourcepub fn feed_chunk<F>(&mut self, f: F) -> Result<FeedProgress, ImportError>
pub fn feed_chunk<F>(&mut self, f: F) -> Result<FeedProgress, ImportError>
Stream the next chunk under chunk_byte_budget, invoke f, update counts.
f receives the chunk bytes and a writer for accepted output bytes.
On EOF after a successful callback the job transitions to ImportStatus::Succeeded.
Sourcepub fn promote(self, dest_dir: &Path) -> Result<PromotedArtifact, ImportError>
pub fn promote(self, dest_dir: &Path) -> Result<PromotedArtifact, ImportError>
Promote staged accepted output into dest_dir (only when status is Succeeded).
Consumes self so the TempDir drops after the promote copy completes.
Auto Trait Implementations§
impl Freeze for ImportJob
impl RefUnwindSafe for ImportJob
impl Send for ImportJob
impl Sync for ImportJob
impl Unpin for ImportJob
impl UnsafeUnpin for ImportJob
impl UnwindSafe for ImportJob
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more