pub struct StagedScheduler { /* private fields */ }Expand description
The staged upload scheduler: given a UploadPolicy, the tiers the path admits, and an
optional force-sync consent, it decides which of an asset’s tier sessions open now and in
what order.
Implementations§
Source§impl StagedScheduler
impl StagedScheduler
Sourcepub fn new(policy: UploadPolicy, class: ConnectionClass) -> Self
pub fn new(policy: UploadPolicy, class: ConnectionClass) -> Self
A scheduler for policy on the detected connection class alone, without
force-sync (the metered/Wi-Fi criteria apply). A caller holding a whole
TransferPlan uses from_plan, which also honours power, heat
and the background deadline.
Sourcepub fn from_plan(plan: &TransferPlan, requested: UploadPolicy) -> Self
pub fn from_plan(plan: &TransferPlan, requested: UploadPolicy) -> Self
A scheduler for the policy the user requested, under plan: a plan that holds bulk
back stages the run (TransferPlan::upload_policy), and every tier is gated on what
the plan admits.
Sourcepub fn narrows_to(&self, next: &Self) -> bool
pub fn narrows_to(&self, next: &Self) -> bool
Whether next closes a tier this scheduler opens: the work running under this one
includes work next forbids.
Sourcepub fn with_force_sync(self, force_sync: bool) -> Self
pub fn with_force_sync(self, force_sync: bool) -> Self
Set the user-consented force-sync flag (the two-week-staleness “sync now”): it overrides the metered/Wi-Fi criteria for above-index tiers, but never resurrects an offline path.
Sourcepub fn tier_opens_now(&self, tier: UploadTier) -> bool
pub fn tier_opens_now(&self, tier: UploadTier) -> bool
Whether a given tier’s session opens right now under this scheduler.
Full opens every tier eagerly; Staged defers to the tier gate: the class’s
(ConnectionClass::permits_tier), or the plan’s (TransferPlan::permits_tier).
Sourcepub fn plan_sessions(&self, asset: &StagedAsset) -> Vec<TierBlob>
pub fn plan_sessions(&self, asset: &StagedAsset) -> Vec<TierBlob>
The blobs to open sessions for now, in strict ladder order.
Under UploadPolicy::Full this is the whole bundle (still ladder-ordered
for a deterministic session sequence). Under UploadPolicy::Staged it is
the ladder prefix the connection currently permits — T0 alone on a metered
link, the whole bundle on unmetered Wi-Fi (or under force-sync). The deferred
tiers carry no client state: the next window re-derives them from server
truth (remaining_tiers).
Sourcepub async fn run<S: TierSink>(
&self,
assets: &[StagedAsset],
sink: &S,
) -> Result<StagedReport, StagedError>
pub async fn run<S: TierSink>( &self, assets: &[StagedAsset], sink: &S, ) -> Result<StagedReport, StagedError>
Drive each asset’s planned tier sessions through sink, per asset, in ladder
order — the session sequence a mock records to prove the ladder. Assets are
processed in the order given; within an asset, strictly T0 → T1 → T2.
Trait Implementations§
Source§impl Clone for StagedScheduler
impl Clone for StagedScheduler
Source§fn clone(&self) -> StagedScheduler
fn clone(&self) -> StagedScheduler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StagedScheduler
Auto Trait Implementations§
impl Freeze for StagedScheduler
impl RefUnwindSafe for StagedScheduler
impl Send for StagedScheduler
impl Sync for StagedScheduler
impl Unpin for StagedScheduler
impl UnsafeUnpin for StagedScheduler
impl UnwindSafe for StagedScheduler
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<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,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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