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
impl Session
Sourcepub fn new(
submission_capacity: usize,
completion_capacity: usize,
) -> Result<(Session, Receiver), SessionError>
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.
Sourcepub fn submission_capacity(&self) -> usize
pub fn submission_capacity(&self) -> usize
The submission ring’s bound.
Sourcepub fn completion_capacity(&self) -> usize
pub fn completion_capacity(&self) -> usize
The completion ring’s bound.
Sourcepub fn enumerations(&self) -> usize
pub fn enumerations(&self) -> usize
How many enumerations this session is currently carrying.
Sourcepub fn is_abandoned(&self) -> bool
pub fn is_abandoned(&self) -> bool
Whether the receiver has abandoned this session, so no further enumeration can be started.
Sourcepub fn try_begin(
&self,
request: EnumerationRequest,
) -> Result<EnumerationHandle, BeginError>
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.
Sourcepub fn try_begin_with_token(
&self,
request: EnumerationRequest,
token: ImpersonationToken,
) -> Result<EnumerationHandle, BeginError>
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.