pub struct MirrorQueue(/* private fields */);Expand description
The queue: one worker, one sync at a time, FIFO, deduplicated by repository.
A named type over JobQueue<Mirror> rather than an alias, so Mirror.Sync’s
door keeps speaking in orders instead of making every caller reach for the
generic.
Implementations§
Source§impl MirrorQueue
impl MirrorQueue
Sourcepub fn new(run: MirrorRunner) -> Self
pub fn new(run: MirrorRunner) -> Self
A queue over run. No thread is started until something is enqueued.
Sourcepub fn enqueue(&self, order: MirrorOrder) -> MirrorJob
pub fn enqueue(&self, order: MirrorOrder) -> MirrorJob
Ask for order.path to be synced, and return without syncing it.
Returns the job now responsible for the repository: a new one, or the one that was already queued or running. Never enqueues a second sync for a repository that has one live — a double-clicked button would otherwise pull the same pack over somebody else’s network twice.
Sourcepub fn status(&self, path: &str) -> Option<MirrorJob>
pub fn status(&self, path: &str) -> Option<MirrorJob>
The job the queue is holding for path, if it still has one.
Sourcepub fn peak_in_flight(&self) -> usize
pub fn peak_in_flight(&self) -> usize
The highest number of syncs that have ever been running together.
Must be 1 after any amount of traffic. 0 before anything has run.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MirrorQueue
impl !UnwindSafe for MirrorQueue
impl Freeze for MirrorQueue
impl Send for MirrorQueue
impl Sync for MirrorQueue
impl Unpin for MirrorQueue
impl UnsafeUnpin for MirrorQueue
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request