Skip to main content

Session

Struct Session 

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

The producing half of a session.

Clone it to submit from several threads; every clone feeds the same submission ring and the same receiver.

Implementations§

Source§

impl Session

Source

pub fn new( submission_capacity: usize, completion_capacity: usize, ) -> Result<(Session, Receiver), SessionError>

Build a session and its receiver.

submission_capacity bounds outstanding control messages and completion_capacity bounds undelivered entries and outcomes. Both are hard bounds: the session never allocates past them in response to load.

§Errors

Returns SessionError if either capacity is below the minimum that can carry one enumeration, or if the thread pool refused to create either of the session’s work objects.

Source

pub fn submission_capacity(&self) -> usize

The submission ring’s bound.

Source

pub fn completion_capacity(&self) -> usize

The completion ring’s bound.

Source

pub fn enumerations(&self) -> usize

How many enumerations this session is currently carrying.

Source

pub fn is_abandoned(&self) -> bool

Whether the receiver has abandoned this session, so no further enumeration can be started.

Source

pub fn try_begin( &self, request: EnumerationRequest, ) -> Result<EnumerationHandle, BeginError>

Start enumerating one directory under the caller’s own security context.

The context is captured synchronously, here, before the request becomes visible to the session. The directory is opened later on a thread-pool worker, whose own identity is unrelated, so capturing at submission is what makes the open happen as whoever asked for it.

Returns immediately with an affine EnumerationHandle. Dropping that handle cancels the enumeration; EnumerationHandle::detach lets it run to completion instead.

§Errors

Returns BeginError when the caller’s context cannot be captured, when either ring cannot secure the room this enumeration would need, or when the receiver has already abandoned the session. Nothing is accepted in any of those cases, and the request comes back with the error.

Source

pub fn try_begin_with_token( &self, request: EnumerationRequest, token: ImpersonationToken, ) -> Result<EnumerationHandle, BeginError>

Start enumerating one directory under an already-captured context.

This is the form a traversal layer wants: capture once when the traversal is submitted, then reuse that one context for every directory in the tree, rather than re-capturing per directory on whatever thread happens to be submitting.

§Errors

As try_begin, except that no capture is attempted and so BeginFailure::TokenCapture cannot occur.

Trait Implementations§

Source§

impl Clone for Session

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 Session

Source§

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

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

impl Drop for Session

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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<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> 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, 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> 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, <T as TryFrom<U>>::Error>

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.