Skip to main content

WorkerEpoch

Struct WorkerEpoch 

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

Per-worker epoch state, padded to avoid false sharing.

Each egress worker holds one of these. The TickEngine reads all pinned fields during reclamation checks; without padding, adjacent workers’ writes would invalidate each other’s cache lines.

128-byte alignment covers both 64-byte (x86) and 128-byte (Apple M-series) cache line sizes.

Implementations§

Source§

impl WorkerEpoch

Source

pub fn new(worker_id: u32) -> Self

Create a new worker epoch in the unpinned state.

last_quiesce_ns is seeded to the current monotonic time so that the first pin is never misclassified as a stall due to elapsed process uptime.

Source

pub fn pin(&self, epoch: u64)

Pin this worker to the given epoch before accessing a snapshot. Records the pin-start timestamp for stall detection.

Source

pub fn unpin(&self)

Unpin this worker after finishing with the snapshot. Updates the quiescence timestamp.

Source

pub fn is_pinned(&self) -> bool

Whether this worker is currently pinned to an epoch.

Source

pub fn pinned_epoch(&self) -> u64

The epoch this worker is pinned to, or EPOCH_UNPINNED.

Source

pub fn pin_start_ns(&self) -> u64

Monotonic nanoseconds when pin() was last called. Used by the tick thread to measure actual pin hold duration.

Source

pub fn last_quiesce_ns(&self) -> u64

Monotonic nanoseconds of the last unpin event.

Source

pub fn is_cancelled(&self) -> bool

Check if cancellation has been requested.

Source

pub fn request_cancel(&self)

Request cancellation (called by TickEngine or shutdown).

Source

pub fn clear_cancel(&self)

Clear cancellation flag (called when worker is restarted/recycled).

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.