Skip to main content

ConsoleHub

Struct ConsoleHub 

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

The console’s state, owned by the connection services.

Implementations§

Source§

impl ConsoleHub

Source

pub fn agent_changed(&self) -> Result<(), ConsoleError>

Makes a real metadata change due without inventing a worker or a flow.

§Errors

The topology lock or revision counter is unavailable.

Source§

impl ConsoleHub

Source

pub fn tap_room(&self, channel: &str) -> Result<bool, TapError>

Whether a new subscription to channel is within the live-tap limit: always for a channel that is not a tap or whose tap is live.

§Errors

Returns TapError::Poisoned when the tap table is poisoned.

Source

pub fn reserve_tap(&self, channel: &str) -> Result<bool, TapError>

Admits a subscribe to channel against MAX_LIVE_TAPS and, for a tap not yet live, reserves its slot in the same lock, so two racing subscribes cannot both take the last slot. Answers false when no slot is left. The attach that follows takes the reservation up; Self::release_tap gives it back when the subscribe fails.

§Errors

Returns TapError::Poisoned when the tap table is poisoned.

Source

pub fn release_tap( &self, channel: &str, retire: impl FnOnce(&str) -> Result<(), ConsoleError>, )

Gives back one reservation of channel for a subscribe that failed after admission. When it was the last and no tap is live there, the tap channel admission registered is taken off the roster by retire, under the taps lock, so no subscribe reserving the tap again can see its entry go: a refused subscribe leaves the roster as it found it. A failed retire queues the subject for the pump; a poisoned table is counted as a detach failure.

Source

pub fn attach(&self, channel: &str) -> Result<(), ConsoleError>

Counts a subscription to channel. A new console.topology subscriber makes the latest document due again, so it is sent the whole topology (R7); the first to a console.tap.<target> starts that target’s tap. Any other channel is ignored.

§Errors

Returns ConsoleError::TapLimit when a new tap would pass MAX_LIVE_TAPS, or ConsoleError::Tap when a lock is poisoned; either is counted in tap_attach_failures.

Source

pub fn detach(&self, channel: &str) -> Result<(), TapError>

Uncounts a subscription to channel. The last one to leave a console.tap.<target> stops that target’s tap and queues the channel for roster removal by the next pump. Safe on the channel actor’s thread: it takes only hub locks and wakes without waiting.

§Errors

Returns TapError::Poisoned when a lock is poisoned; counted in tap_detach_failures.

Source

pub fn attached_subjects(&self) -> Result<Vec<String>, TapError>

Subjects with a live tap, sorted.

§Errors

Returns TapError::Poisoned when the tap table is poisoned.

Source§

impl ConsoleHub

Source

pub fn new( device: &str, model: TopologyModel, wall: WallBase, ) -> Result<Self, ConsoleError>

A hub for device holding model, timing records from wall, with a tap of the default capacity.

§Errors

Returns ConsoleError::EmptyDevice when device is blank.

Source

pub fn with_capacity( device: &str, model: TopologyModel, wall: WallBase, capacity: usize, ) -> Result<Self, ConsoleError>

As Self::new, with each tap subscriber’s ring holding capacity.

§Errors

Returns ConsoleError::EmptyDevice when device is blank.

Source

pub fn device(&self) -> &str

The device this hub publishes for (liminal.<device>).

Source

pub const fn tap(&self) -> &Tap

The tap.

Source

pub fn serving_station(&self, subject: &str) -> Result<Option<String>, TapError>

The station serving a registered local responder subject.

§Errors

The topology lock is poisoned.

Source

pub fn counts(&self) -> ConsoleCountsSnapshot

Every console counter as it stands.

Source

pub fn incarnation_started(&self, started: Instant) -> Result<(), TapError>

This server’s incarnation started at started; the topology’s uptime runs from there and the next document says so.

§Errors

Returns TapError::Poisoned when the topology lock is poisoned.

Source

pub fn suppressed(&self)

Counts a dedup-suppressed re-publish, which is not tapped.

Source

pub fn observe_failed(&self)

Counts a publish the tap could not observe (its lock was poisoned). The publish itself answered as it would without the console.

Source

pub fn set_notifier(&self, notifier: TapWaker) -> Result<(), TapError>

Installs the function that tells the publisher there is work. The publisher calls Self::pump on its own thread when told.

§Errors

Returns TapError::Poisoned when the slot is poisoned.

Source

pub fn wake_if_due(&self) -> Result<(), TapError>

Wakes the publisher when work is already waiting: a topology subscriber, a live tap or a tap to retire. The start of the console streams calls it, so a subscriber that arrived before the publisher ran is served, and an idle server is never woken.

§Errors

Returns TapError::Poisoned when a hub lock is poisoned.

Source

pub fn emit(&self, change: TopologyChange) -> Result<(), TapError>

Applies change to the held topology. A change that alters it makes the document due, and wakes the publisher when someone subscribes.

§Errors

Returns TapError::Poisoned when the topology lock is poisoned; the change is counted in topology_emit_failures.

Source

pub fn pump( &self, out: &dyn ServerPublisher, ) -> Result<PumpReport, ConsoleError>

Publishes what is due through out: the topology document when it changed and someone subscribes, then each live tap’s records, a tap’s kept records first and its ring drained only when none are kept; then removes retired tap channels from the roster. A failed publish keeps that record and the tap’s later ones for the next pump, and the pump goes on to the other taps.

§Errors

Returns ConsoleError when a lock is poisoned or a record cannot be encoded; publish failures are counted and reported, not returned.

Trait Implementations§

Source§

impl Debug for ConsoleHub

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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