Skip to main content

Tap

Struct Tap 

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

The server’s tap. Cheap to clone; every clone is the same tap.

Implementations§

Source§

impl Tap

Source

pub fn source_station( &self, source: TapSource, ) -> Result<Option<Arc<str>>, TapError>

The station already registered for this source.

§Errors

The station registry is poisoned.

Source

pub fn observe_call(&self, fact: &CallFact<'_>) -> Result<bool, TapError>

Offers one call’s terminal outcome to the same sampled rings as publishes. No payload is retained, and the drainer is told after every lock is released.

§Errors

A tap lock is poisoned, or a measured hop cannot be represented.

Source§

impl Tap

Source

pub fn observe(&self, fact: &PublishFact<'_>) -> Result<bool, TapError>

The hook: one publish return. With no subscription it is one atomic load and nothing else. Otherwise each matching subscription decides under its own lock whether to keep the message before anything is allocated for it; a kept message allocates its subject and its hops (and its reply-to, and a payload copy under a grant), and the drainer is woken once, after every tap lock is released. Answers whether any subscription kept it.

§Errors

Returns TapError::Poisoned when a tap lock is poisoned; any subscription that kept the message before it still wakes the drainer. Returns TapError::StationsDisagree when its station list was refused: the message is kept, its receivers not recorded. Returns TapError::HopsOutOfOrder when a hop was measured before the one ahead of it: the message is kept with its hops as measured. Returns TapError::HopBeforeFirstSight or TapError::HopOverflow when a hop could not be carried: the message is kept without it. More than one of these is TapError::Several, each named.

Source§

impl Tap

Source

pub fn new(node: &str, capacity: usize) -> Self

A tap whose hops name node, with per-subscriber rings of capacity, that wakes nobody: for a reader that drains when it chooses, as a test does.

Source

pub fn with_waker(node: &str, capacity: usize, waker: TapWaker) -> Self

A tap that calls waker once per publish any subscription kept. Fixed at construction, so the hot path reads it without a lock and nothing can replace it.

Source

pub fn with_depot(self, depot: bool) -> Self

This tap, on a server that keeps a persistent store when depot: its kept durable messages then pass <node>.depot (lane brief ruling 8).

Source

pub fn reserved(&self, id: &str) -> Option<&'static str>

The station id would collide with: this tap’s exchange (its node) or its depot. A worker with such an identity names no station here.

Source

pub fn subscribe(&self, filter: TapFilter) -> Result<TapSubscription, TapError>

Subscribes without payloads.

§Errors

Returns TapError::Poisoned when the subscriber list is poisoned.

Source

pub fn subscribe_with( &self, filter: TapFilter, grant: Option<PayloadGrant>, ) -> Result<TapSubscription, TapError>

Subscribes, with payloads when grant is present.

§Errors

Returns TapError::Poisoned when the subscriber list is poisoned.

Source

pub fn observations(&self) -> u64

Publishes the hook has shown the tap while a subscription was live (a count pin: N ordinary publishes give N, the tap’s own records give zero).

Source

pub fn subscriber_count(&self) -> usize

Live subscriptions.

Source

pub fn dropped_total(&self) -> u64

Messages evicted from every subscription’s ring since the tap was made.

Source

pub fn name_station( &self, connection: u64, station: &str, ) -> Result<(), TapError>

Names station as the station connection publishes as, from its worker registration until Self::forget_station.

§Errors

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

Source

pub fn forget_station(&self, connection: u64) -> Result<(), TapError>

Forgets connection’s station, as its connection closes.

§Errors

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

Source

pub fn name_receiver( &self, subscriber: u64, connection: u64, ) -> Result<(), TapError>

Names connection as the owner of the subscription whose subscriber pid is subscriber, until Self::forget_receiver.

§Errors

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

Source

pub fn forget_receiver(&self, subscriber: u64) -> Result<(), TapError>

Forgets the subscription whose subscriber pid is subscriber, as it leaves its channel.

§Errors

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

Source

pub fn forget_receivers_of(&self, connection: u64) -> Result<(), TapError>

Forgets every subscription of connection, as it closes.

§Errors

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

Source

pub fn lend_recipients(&self) -> Result<Option<PublishRecord>, TapError>

A buffer for a publish to record its recipients in, only while a subscription is live: with none it is one atomic load, no lock and no allocation, and the publish records nothing. A buffer lent comes from those given back, so it allocates only while the pool and each buffer grow to the widest concurrent fan-out.

§Errors

Returns TapError::Poisoned when the buffer pool is poisoned.

Source

pub fn give_back(&self, buffer: PublishRecord) -> Result<(), TapError>

Takes back a buffer Self::lend_recipients lent, emptied, for the next recording publish.

§Errors

Returns TapError::Poisoned when the buffer pool is poisoned.

Source

pub fn recipients_lent(&self) -> u64

Recipient buffers lent since the tap was made: publishes that asked the fan-out for their recipients.

Source

pub fn unsubscribe_failures(&self) -> u64

Subscriptions whose drop found the subscriber list poisoned and so could not leave it.

Trait Implementations§

Source§

impl Clone for Tap

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

impl Debug for Tap

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Tap

§

impl !UnwindSafe for Tap

§

impl Freeze for Tap

§

impl Send for Tap

§

impl Sync for Tap

§

impl Unpin for Tap

§

impl UnsafeUnpin for Tap

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