Skip to main content

Session

Struct Session 

Source
pub struct Session<E> { /* private fields */ }
Expand description

What a connection is served with, as a Resolver builds it.

Implementations§

Source§

impl<E> Session<E>

Source

pub fn new(executor: E) -> Self

A session over executor, kept for the whole connection.

Source

pub fn tenant(self, tenant: impl Into<String>) -> Result<Self, TenantError>

Serves the connection in tenant alone, whatever tenant its requests name: reads and loads see only tenant’s events, writes land in tenant, and the version, routing-key and snapshot lookups are tenant’s. A host that maps a client’s credential to a tenant in its Resolver confines the client this way, over one store shared by every tenant.

The client sees a store of its own: the events it reads come back in the default tenant (""), so it names no tenant anywhere — its projections, snapshots and cursors are kept as against a store of a single tenant.

Requests that would reach past the tenant are refused: replicate, which keeps the caller’s timestamps (an event backdated behind the cursor of a subscription over the shared store would never reach it), and the subscriber calls, since a subscriber row belongs to no tenant. A tenant’s application keeps its subscriptions in a store of its own: a Sidecar (evento-core’s rw feature) with the client as its events source.

§Errors

TenantError for "" — the default tenant, which a session serving no tenant reaches along with every other — or for a tenant id longer than a store keeps.

Source

pub fn keep(self, guard: impl Any + Send + Sync) -> Self

Keeps guard alive until the connection ends, then drops it. A host leases a tenant to the connection this way: the lease is released when the client goes away, whatever the reason.

Source

pub fn close_when(self, signal: Receiver<bool>) -> Self

Ends the connection from the server’s side when signal turns true (a credential was revoked). In-flight requests fail at the client, and its reconnect goes through the resolver again, which can now refuse it.

Auto Trait Implementations§

§

impl<E> !RefUnwindSafe for Session<E>

§

impl<E> !UnwindSafe for Session<E>

§

impl<E> Forget for Session<E>

§

impl<E> Freeze for Session<E>
where E: Freeze,

§

impl<E> Move for Session<E>

§

impl<E> Send for Session<E>
where E: Send,

§

impl<E> Sync for Session<E>
where E: Sync,

§

impl<E> Unpin for Session<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for Session<E>
where E: UnsafeUnpin,

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> 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> 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<New, Old> UpcastFrom<Old> for New
where New: From<Old>,

Source§

fn upcast_from(old: Old) -> New

Converts the older event into this one.
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