Skip to main content

MembershipGate

Struct MembershipGate 

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

The membership gate: the product mapping, the provider seam, the authority seam and the bounded decision index (ACCESS-006 R1, R2, R6).

Implementations§

Source§

impl MembershipGate

Source

pub fn new( config: &MembershipConfig, provider: Arc<dyn MembershipProvider>, ) -> Result<Self, ServerError>

Builds the gate from the validated product mapping over provider. No authority is installed: until one is, every protected act refuses MembershipRefusal::AuthorityMissing.

§Errors

ServerError::ConfigValidation naming the first invalid member: a contract other than CONTRACT_VERSION, an empty or control-bearing kind, log identity or mapping member, equal workspace and channel kinds, a zero bound, no protected channel, a channel or resource mapped twice, a conversation naming an unlisted channel, or a connect_workspace the mapping does not list.

Source

pub fn install_authority( &self, authority: Arc<dyn MembershipAuthority>, ) -> Result<(), Arc<dyn MembershipAuthority>>

Installs the ACCESS-005 grant authority once.

§Errors

Returns the authority back when one is already installed, so one owner cannot be swapped for another under live bindings.

Source

pub fn install_stream_authority(&self) -> Result<Arc<StreamState>, ServerError>

Installs the production stream authority before protected admission.

§Errors

Refuses an existing authority of another owner; it is never swapped live.

Source

pub const fn served_log(&self) -> &GrantLog

The grant log this gate asks from.

Source

pub fn protects(&self, channel: &str) -> bool

Whether channel is membership-protected.

Source

pub fn mapped(&self, channel: &str) -> Option<&MappedChannel>

The protected channel’s placement, as the mapping states it.

Source

pub fn channel_for_conversation(&self, conversation: u64) -> Option<&str>

The protected channel a participant conversation is placed under, as the mapping states it; None is unmapped, never guessed.

Source

pub fn counts(&self) -> MembershipCounts

Every count, as of now.

Source

pub fn retained(&self) -> Result<usize, MembershipRefusal>

How many decisions the index retains.

§Errors

MembershipRefusal::IndexPoisoned.

Source

pub fn check( &self, pid: u64, holder: Option<&MembershipSubject>, channel: &str, action: MembershipAction, ) -> Result<Decided, MembershipRefusal>

Decides action on channel for connection pid’s verified holder: Decided::NotProtected for a channel the mapping does not list; otherwise the current decision, from the index when it holds one at the authority’s generation, asked of the provider once when it does not. The lock is never held across the ask.

§Errors

The exact MembershipRefusal: no verified holder, the authority’s state, the index bound, the provider’s refusal or failure, or an answer that is not the one asked.

Source

pub fn check_release( &self, pid: u64, holder: Option<&MembershipSubject>, channel: &str, action: MembershipAction, ) -> Result<Decided, MembershipRefusal>

Self::check at a final data-release seam (ACCESS-006 R3), counted as a release check.

§Errors

As for Self::check.

Source

pub fn admit_connect( &self, holder: &MembershipSubject, ) -> Result<Option<u64>, MembershipRefusal>

Scoped guest admission at Connect (ACCESS-006 R1): when the mapping names a connect_workspace, the holder must hold a current grant somewhere in it. Admission opens no channel; every act after it is decided on its own. Ok(None) when no admission is configured.

§Errors

The authority’s state, the provider’s failure, a substituted or stale answer, or Lys’s refusal by name (membership_no_current_grant).

Source

pub fn release_connection(&self, pid: u64)

Releases every binding connection pid held (ACCESS-006 R6); a binding no connection holds leaves the index. A poisoned index is logged and left: it already refuses every check.

Source§

impl MembershipGate

Source

pub fn resource_page( &self, holder: Option<&MembershipSubject>, workspace: &str, action: MembershipAction, after: Option<&PageCursor>, ) -> Result<ChannelPage, MembershipRefusal>

One page of the protected channels holder may action within workspace (ACCESS-006 R4): both bounds the operator’s, every row checked against the question, the continuation bound to it.

§Errors

The exact MembershipRefusal: no verified holder, an unmapped workspace, the authority’s state, a foreign or stale continuation, the provider’s failure or refusal, or a page that is not the one asked (over bound, foreign or duplicate row, inconsistent counts).

Source

pub fn recipient_page( &self, channel: &str, action: MembershipAction, after: Option<&PageCursor>, ) -> Result<RecipientPage, MembershipRefusal>

One page of the subjects who may action on the protected channel (ACCESS-006 R4), checked as Self::resource_page is.

§Errors

As for Self::resource_page, with MembershipRefusal::ChannelNotMapped for an unmapped channel.

Trait Implementations§

Source§

impl Debug for MembershipGate

Source§

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

Formats the value using the given formatter. Read more
Source§

impl MembershipListener for MembershipGate

Source§

fn changed( &self, change: &MembershipChange, ) -> Result<AppliedChange, MembershipRefusal>

Re-decides the retained bindings change reaches. Read more
Source§

fn resumed( &self, generation: u64, revision: u64, ) -> Result<ResumeReport, MembershipRefusal>

Re-decides every retained binding once at revision and adopts generation when all agree. 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