Skip to main content

Job

Struct Job 

Source
struct Job<'a> {
Show 16 fields config: &'a JobConfig, op_id: String, kind: FsOpKind, control: Arc<OpControl>, emit: Arc<dyn Fn(&FsOpEvent) + Send + Sync>, protect: ProtectedPaths, done_items: u64, total_items: u64, done_bytes: u64, total_bytes: u64, current: Option<String>, failures: Vec<FsOpResult>, sticky: Option<FsOpChoice>, stop_reason: Option<String>, last_running: Option<Instant>, buf: Vec<u8>,
}

Fields§

§config: &'a JobConfig§op_id: String§kind: FsOpKind§control: Arc<OpControl>§emit: Arc<dyn Fn(&FsOpEvent) + Send + Sync>§protect: ProtectedPaths§done_items: u64§total_items: u64§done_bytes: u64§total_bytes: u64§current: Option<String>§failures: Vec<FsOpResult>§sticky: Option<FsOpChoice>

An answer given with “apply to all”.

§stop_reason: Option<String>

Why the op stopped by itself, for the final canceled event.

§last_running: Option<Instant>§buf: Vec<u8>

Implementations§

Source§

impl<'a> Job<'a>

Source

fn new( config: &'a JobConfig, op_id: String, kind: FsOpKind, control: Arc<OpControl>, emit: Arc<dyn Fn(&FsOpEvent) + Send + Sync>, ) -> Self

Source

fn verb(&self) -> &'static str

Source

fn event(&self, state: FsOpEventState) -> FsOpEvent

Source

fn emit_now(&mut self, state: FsOpEventState)

Source

fn tick(&mut self)

A running event, unless one went out within PROGRESS_INTERVAL. Dropping one loses nothing: the next carries the counts, and the final event always goes out.

Source

fn set_current(&mut self, src: &Path)

Source

fn advance(&mut self, m: Measure)

Source

fn fail(&mut self, src: &Path, error: String)

Source

fn pass_over(&mut self, src: &Path, meta: &Metadata, hint: Option<Measure>)

Count src’s subtree as handled without copying it (skipped, or failed before anything was written), so progress still reaches the total.

Source

fn finish(&mut self, ending: Ending, requested: usize, dest: &str)

Source

fn execute(&mut self, plan: &Plan) -> Ending

Source

fn measure(&self, path: &Path) -> Option<Measure>

Count entries and file bytes under path without following links. What can’t be read counts as one entry; the copy reports it. None if canceled meanwhile.

Source

fn transfer( &mut self, src: &Path, dest: &Path, duplicate: bool, hint: Option<Measure>, cross: bool, ) -> Outcome

Copy or move src to dest, asking about a conflict, merging a folder into a folder. hint is src’s measure when already known. cross is set inside a move that already found it crosses volumes, so each entry doesn’t retry the rename.

Source

fn ask( &mut self, src: &Path, meta: &Metadata, dest: &Path, dest_meta: &Metadata, ) -> Option<FsOpChoice>

Block in conflict until answered. None if canceled, or if the wait limit passed (then stop_reason says so).

Source

fn ask_about( &mut self, src: &str, meta: EntrySide, dest: &str, dest_meta: EntrySide, ) -> Option<FsOpChoice>

Self::ask for any two entries, local or on a host, by their display paths and what they are.

Source

fn place( &mut self, src: &Path, meta: &Metadata, dest: &Path, how: How, hint: Option<Measure>, cross: bool, ) -> Result<Outcome, Raced>

Put src at dest the way how says.

Source

fn place_by_rename( &mut self, src: &Path, meta: &Metadata, dest: &Path, how: How, hint: Option<Measure>, ) -> Renamed

Source

fn place_file( &mut self, src: &Path, meta: &Metadata, dest: &Path, how: How, ) -> Result<Outcome, Raced>

Source

fn settle_file(&mut self, start_bytes: u64, meta: &Metadata)

The file’s progress once it is handled, whatever happened: one item, and its size (or what was written, if it grew).

Source

fn copy_to_temp( &mut self, src: &Path, meta: &Metadata, dest: &Path, ) -> Result<PathBuf, CopyError>

Stream src into a new temporary file beside dest. On any error or cancel the temporary file is removed.

Source

fn stream( &mut self, from: &mut File, to: &mut File, src: &Path, ) -> Result<u64, CopyError>

Copy all of from into to in chunk_size pieces, checking for cancel before each. Returns the bytes written.

Source

fn stream_with( &mut self, buf: &mut [u8], from: &mut File, to: &mut File, src: &Path, ) -> Result<u64, CopyError>

Source

fn place_dir( &mut self, src: &Path, meta: &Metadata, dest: &Path, how: How, cross: bool, ) -> Result<Outcome, Raced>

Source

fn merge(&mut self, src: &Path, dest: &Path, cross: bool) -> Outcome

Merge the folder src into the existing folder dest (spec §7.2).

Source

fn remove_moved_dir(&mut self, src: &Path) -> Outcome

A moved folder’s source, once everything inside it went. Only ever an empty folder: remove_dir refuses anything else.

Source

fn copy_children(&mut self, src: &Path, dest: &Path, cross: bool) -> Outcome

Each entry of src into dest. The names are read up front: a move takes entries out of src while going, and a directory changing under an open listing may skip entries on some filesystems.

Source

fn replace_aside( &mut self, src: &Path, dest: &Path, put: impl FnOnce(&Path) -> Result<()>, ) -> Result<()>

Replace dest with what put creates there: move dest aside under a temporary name in the same folder first, remove it once put succeeded, or put it back if put failed. Used whenever a rename can’t atomically replace (a folder, a link, a type change).

Source

fn drop_aside(&mut self, src: &Path, spot: &Path)

Delete the replaced original. It was the user’s choice to replace it; failing to delete it is reported but loses nothing.

Source

fn restore_aside(&mut self, src: &Path, spot: &Path, dest: &Path)

Put a set-aside original back at dest, or, if something took that name meanwhile, under the first free name (n) beside it rather than leave it under a hidden temporary name.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Job<'a>

§

impl<'a> !UnwindSafe for Job<'a>

§

impl<'a> Freeze for Job<'a>

§

impl<'a> Send for Job<'a>

§

impl<'a> Sync for Job<'a>

§

impl<'a> Unpin for Job<'a>

§

impl<'a> UnsafeUnpin for Job<'a>

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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