pub struct Jobs {
config: JobConfig,
ops: Mutex<HashMap<String, Arc<OpControl>>>,
active: Mutex<usize>,
slot_freed: Condvar,
}Expand description
The ops in flight, and the slots they take turns on.
Fields§
§config: JobConfig§ops: Mutex<HashMap<String, Arc<OpControl>>>§active: Mutex<usize>§slot_freed: CondvarImplementations§
Source§impl Jobs
impl Jobs
pub fn new(config: JobConfig) -> Self
fn protected(&self) -> ProtectedPaths
Sourcepub fn start(
self: &Arc<Self>,
req: &FsOpStartReq,
emit: Arc<dyn Fn(&FsOpEvent) + Send + Sync>,
) -> Result<FsOpStartResult, String>
pub fn start( self: &Arc<Self>, req: &FsOpStartReq, emit: Arc<dyn Fn(&FsOpEvent) + Send + Sync>, ) -> Result<FsOpStartResult, String>
fs.op.start: validate, then run in the background. Blocking (it
stats and canonicalizes), so call it from spawn_blocking.
Sourcepub(super) fn start_host(
self: &Arc<Self>,
kind: FsOpKind,
requested: usize,
dest: String,
emit: Arc<dyn Fn(&FsOpEvent) + Send + Sync>,
work: Box<dyn FnOnce(&mut HostJob<'_, '_>) -> Result<(), HostStop> + Send>,
) -> Result<FsOpStartResult, String>
pub(super) fn start_host( self: &Arc<Self>, kind: FsOpKind, requested: usize, dest: String, emit: Arc<dyn Fn(&FsOpEvent) + Send + Sync>, work: Box<dyn FnOnce(&mut HostJob<'_, '_>) -> Result<(), HostStop> + Send>, ) -> Result<FsOpStartResult, String>
Run work as an op of kind in this registry, the way Self::start
runs a local one: its own thread, a slot, cancel and conflict answers
through fs.op.cancel and fs.op.resolve, progress as files:op
events, and the audit line at the end (dest and requested are for
it). For transfers that touch an SSH host (host_jobs).
Sourcepub fn resolve(
&self,
op_id: &str,
choice: FsOpChoice,
apply_to_all: bool,
) -> Result<(), String>
pub fn resolve( &self, op_id: &str, choice: FsOpChoice, apply_to_all: bool, ) -> Result<(), String>
fs.op.resolve. Only an op blocked on a conflict takes an answer: one
stored ahead of time would silently decide whatever conflict came
next.
Sourcepub fn cancel(&self, op_id: &str)
pub fn cancel(&self, op_id: &str)
fs.op.cancel. Wakes the op whether it is copying, waiting on a
conflict or queued for a slot. Unknown or finished ops are ignored.
Auto Trait Implementations§
impl !Freeze for Jobs
impl !RefUnwindSafe for Jobs
impl !UnwindSafe for Jobs
impl Send for Jobs
impl Sync for Jobs
impl Unpin for Jobs
impl UnsafeUnpin for Jobs
Blanket Implementations§
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§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