Skip to main content

Sidecar

Struct Sidecar 

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

The sidecar singleton. Internally a pool of one NodeSidecar per detected NUMA node; each node has its own scanning thread + Vec of registered primitive instances. Registration routes by current_numa_node() so cross-NUMA cache traffic on the scan path stays minimal. InstanceId encodes (node_index, slot) so unregister

  • stats can find the right node’s vec.

Implementations§

Source§

impl Sidecar

Source

pub unsafe fn register_raw( &self, header: NonNull<HandshakeHeader>, ring: NonNull<ObservationRing>, instance: Option<NonNull<dyn AdaptiveInstance>>, policy: Box<dyn Policy>, ) -> InstanceId

Register a primitive instance.

§Safety

header, ring, and (when provided) instance must remain valid until unregister(id) returns for the returned id. Prefer SidecarBox which enforces this invariant automatically.

Source

pub fn unregister(&self, id: InstanceId)

Remove a registered instance.

Blocks until any in-flight scan iteration finishes, so the caller can safely drop the underlying header/ring memory immediately after this returns.

Source

pub fn instance_count(&self) -> usize

Currently-registered instance count.

Source

pub fn max_instances(&self) -> usize

Configured maximum simultaneously-registered instances. See DEFAULT_MAX_INSTANCES for the default and Self::set_max_instances to change it.

Source

pub fn set_max_instances(&self, cap: usize)

Raise or lower the instance cap. Intentional heavy-registration workloads (e.g., a server that legitimately wants > 10,000 adaptive primitives live at once) should call this once at startup. The cap is per-process; the global Sidecar inherits it via global().

Source

pub fn stats(&self, id: InstanceId) -> Option<InstanceStats>

Snapshot the stats for a registered instance.

Source

pub fn scan_now(&self)

Force one scan iteration synchronously across all NUMA nodes. Useful for tests where we don’t want to wait for the poll interval.

Source

pub fn node_count(&self) -> usize

Number of NUMA-pinned sidecar threads in this pool.

Trait Implementations§

Source§

impl Drop for Sidecar

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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<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.