pub struct SlotRoster { /* private fields */ }Expand description
The connection slots of a node (module documentation).
Implementations§
Source§impl SlotRoster
impl SlotRoster
Sourcepub fn new(slots: usize) -> SlotRoster
pub fn new(slots: usize) -> SlotRoster
A roster of slots free slots, 0..slots (at most u16::MAX + 1).
Sourcepub const fn capacity(&self) -> usize
pub const fn capacity(&self) -> usize
The number of connection slots 0..capacity managed by this roster.
Sourcepub fn arrive(&self, edge: Did, floor_use: &SlotFloorUse)
pub fn arrive(&self, edge: Did, floor_use: &SlotFloorUse)
Give edge the cleanest free slot under floor_use (module law), unless it holds one.
With no slot free, which the registry’s bound of R connection records rules out, edge
holds none and its deliveries are Principal::Unbound; it is a current edge all the
same, and takes a slot at a later arrival that finds one free. Only an edge that was not
current changes the count and notifies (the edge-watch law). O(R log R).
Sourcepub fn set_extra_floor_use(&self, floor_use: SlotFloorUse)
pub fn set_extra_floor_use(&self, floor_use: SlotFloorUse)
Update the additional per-slot floor use combined with caller-supplied floor use on arrival (used by external slot-accounted tables sharing this roster, such as Onion link admission).
Sourcepub fn arrive_preferring(
&self,
edge: Did,
preferred: Option<u16>,
floor_use: &SlotFloorUse,
)
pub fn arrive_preferring( &self, edge: Did, preferred: Option<u16>, floor_use: &SlotFloorUse, )
Give edge preferred if that slot is currently free, or else the cleanest free slot
under floor_use joined with any registered external floor use (module law), unless edge
already holds a slot. Used when a reconnecting peer still has residual window load bound to
preferred so it resumes its own slot ledger instead of acquiring a fresh one.
Sourcepub fn holds(&self, edge: Did) -> bool
pub fn holds(&self, edge: Did) -> bool
Whether edge holds a slot: an arrival of such an edge keeps it, so its caller need not
read the tables’ floor use.
Sourcepub fn depart(&self, edge: Did)
pub fn depart(&self, edge: Did)
Free the slot of edge, if it holds one; edge is no longer a current edge.
Sourcepub fn changed(&self) -> EventListener ⓘ
pub fn changed(&self) -> EventListener ⓘ
A listener woken by the next change of the current edges after this call (the edge-watch law).
Sourcepub fn principal_of(&self, edge: Option<Did>) -> Principal
pub fn principal_of(&self, edge: Option<Did>) -> Principal
The principal a delivery on edge is charged to: its slot, or Principal::Unbound
for no edge or an edge that holds none.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SlotRoster
impl Forget for SlotRoster
impl Move for SlotRoster
impl RefUnwindSafe for SlotRoster
impl Send for SlotRoster
impl Sync for SlotRoster
impl Unpin for SlotRoster
impl UnsafeUnpin for SlotRoster
impl UnwindSafe for SlotRoster
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for T
impl<T> MaybeSendSync for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.