Skip to main content

SpeculationController

Struct SpeculationController 

Source
pub struct SpeculationController { /* private fields */ }
Expand description

Runtime-neutral owner of one volume generation’s two speculation engines.

The controller performs no I/O and spawns no work. It gives embedded, browser, daemon, and fleet adapters one atomic transition surface while execution remains pull-based through execute_residency and execute_promotion.

Implementations§

Source§

impl SpeculationController

Source

pub fn new( options: SpeculationOptions, volume_id: VolumeId, generation_id: GenerationId, ) -> Result<Self, SpeculationControllerError>

Creates both engines against the same exact volume generation.

§Errors

Rejects an invalid policy without retaining either partial engine.

Source

pub fn observe_hint( &mut self, operation_id: OperationId, volume_id: VolumeId, generation_id: GenerationId, foreground_bytes: u64, hint: ResidencyHint, ) -> Result<ResidencyAdmission, SpeculationControllerError>

Records foreground demand and evaluates its already-authenticated successor as one all-or-nothing transition.

§Errors

Leaves foreground history and admission state unchanged on exact accounting failure.

Source

pub fn plan_promotion( &mut self, permit: ResidencyPermit, accepted_tiers: Vec<StorageTier>, residency: &[ObjectResidency], destinations: &[PromotionDestination], ) -> Result<PromotionAdmission, SpeculationControllerError>

Converts an admitted local prediction into a bounded promotion plan.

§Errors

Leaves promotion state unchanged on policy or accounting failure.

Source

pub fn finish_residency( &mut self, operation_id: OperationId, useful: bool, ) -> Result<(), SpeculationControllerError>

Records terminal local-residency usefulness exactly once.

§Errors

Rejects unknown identities or accounting overflow without mutation.

Source

pub fn finish_promotion( &mut self, operation_id: OperationId, useful: bool, ) -> Result<(), SpeculationControllerError>

Records terminal promotion usefulness exactly once.

§Errors

Rejects unknown identities or accounting overflow without mutation.

Source

pub fn preempt_for_foreground( &mut self, foreground_bytes: u64, ) -> Result<SpeculationPreemption, SpeculationControllerError>

Preempts both engines before recording new foreground traffic.

§Errors

Commits all cancellations and traffic together or changes neither engine.

Source

pub fn replace_generation( &mut self, generation_id: GenerationId, ) -> Result<SpeculationPreemption, SpeculationControllerError>

Atomically fences both engines onto a new immutable generation.

§Errors

Leaves both engines on the old generation if either transition fails.

Source

pub const fn metrics(&self) -> SpeculationMetrics

Returns both exact metrics from one committed controller state.

Source

pub const fn residency(&self) -> &ResidencySpeculator

Borrows the local residency engine for pull-based execution.

Source

pub const fn promotion(&self) -> &PromotionSpeculator

Borrows the promotion engine for pull-based execution.

Source

pub fn active_residency_permit( &self, operation_id: OperationId, ) -> Option<ResidencyPermit>

Returns one currently active local execution permit.

Trait Implementations§

Source§

impl Clone for SpeculationController

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

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

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

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

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> StorageFuture for T
where T: Send,

Source§

impl<T> StorageProvider for T
where T: Send + Sync + ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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

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

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