Skip to main content

DeliveryHandle

Struct DeliveryHandle 

Source
pub struct DeliveryHandle<D> { /* private fields */ }
Expand description

The operations of an instance whose delivery an EntryDelivery owns, through &self from any thread. The handler is given one; the owner derefs to its own, so both offer the same operations from one definition.

Each call takes the front end’s lock on the instance for its duration – dioring’s lock in DI-D-18’s order, taken before the ring’s – and the handler is called with that lock released.

§What it withholds

  • pop and readiness: the delivery is the single deliverer and the signal’s one waiter (DI-D-28). A second popper would take entries out of order; a second waiter would steal wakes.
  • Any &mut to the instance, including through a closure. Safe code could then replace the instance while the wait stayed armed on the old one’s signal, and delivery would stop without an error – the ring crate’s measured defect (D-43), which a closure does not close. Registered bytes are therefore reached through closures over the bytes alone.

Not constructible, and not Clone: a handler holds one only for the length of a call, so it cannot keep the front end alive.

Implementations§

Source§

impl<D: DurableRing> DeliveryHandle<D>

Source

pub fn add_target( &self, key: IoTargetKey, target: D::Target, ) -> Result<(), AddTargetError<D::Target>>

Source

pub fn remove_target( &self, key: IoTargetKey, ) -> Result<D::Target, RemoveTargetError<D::Ids>>

Source

pub fn default_lineage(&self) -> HandleOf<D>

Source

pub fn mint_lineage(&self, description: Option<String>) -> HandleOf<D>

Source

pub fn lineages(&self) -> Vec<LineageInfo<D::Ids>>

Source

pub fn end_lineage( &self, handle: HandleOf<D>, ) -> Result<(), EndLineageError<D::Ids>>

Source

pub fn retire_lineage( &self, handle: HandleOf<D>, ) -> Result<(), RetireLineageError<D::Ids>>

Source

pub fn write( &self, file: IoTargetKey, offset: u64, buffer: D::Buffer, tag: Tag<'_, D::Ids>, context: D::Context, ) -> PushResult<D>
where D::Buffer: IoBuf,

Source

pub fn write_with( &self, file: IoTargetKey, offset: u64, buffer: D::Buffer, tag: Tag<'_, D::Ids>, context: D::Context, options: WriteOptions<D::Ids>, ) -> PushResult<D>
where D::Buffer: IoBuf,

Source

pub fn read( &self, file: IoTargetKey, offset: u64, buffer: D::Buffer, context: D::Context, ) -> PushResult<D>
where D::Buffer: IoBufMut,

Source

pub fn read_with( &self, file: IoTargetKey, offset: u64, buffer: D::Buffer, context: D::Context, options: ReadOptions<D::Ids>, ) -> PushResult<D>
where D::Buffer: IoBufMut,

Source

pub fn make_durable_through( &self, through: Tag<'_, D::Ids>, ) -> Result<DurabilityRequest<D::Ids>, SealError<D::Ids>>

Source

pub fn durable_through( &self, lineage: Lin<D>, ) -> Result<Option<EpochIdOf<D>>, UnknownLineage<D::Ids>>

Source

pub fn sealed_through( &self, lineage: Lin<D>, ) -> Result<Option<EpochIdOf<D>>, UnknownLineage<D::Ids>>

Source

pub fn epoch_state( &self, epoch: Epoch<D::Ids>, ) -> Result<EpochState<D::Ids>, UnknownLineage<D::Ids>>

Source

pub fn resolve( &self, items: Vec<(TokenOf<D>, Resolution)>, ) -> Result<(), ResolveError<D::Ids>>

Source

pub fn import_failure( &self, scope: ImportScope<D::Ids>, ) -> Result<Imported<D::Ids>, UnknownLineage<D::Ids>>

Source

pub fn failures(&self) -> Vec<FailureInfo<D::Ids>>

Source

pub fn take_token(&self, failure: FailureIdOf<D>) -> Option<TokenOf<D>>

Source§

impl<D: RegisteredBufferRing> DeliveryHandle<D>

Source

pub fn with_registered_buffer<R>( &self, i: u32, f: impl FnOnce(&[u8]) -> R, ) -> Result<R>

Run f on the bytes of registered buffer i, under the front end’s lock.

§Errors

As RegisteredBufferRing::with_registered_buffer.

Source

pub fn with_registered_buffer_mut<R>( &self, i: u32, f: impl FnOnce(&mut [u8]) -> R, ) -> Result<R>

Run f on the bytes of registered buffer i, mutably, under the front end’s lock.

§Errors

As RegisteredBufferRing::with_registered_buffer_mut.

Source

pub fn write_registered( &self, file: IoTargetKey, offset: u64, span: RegisteredSpan, tag: Tag<'_, D::Ids>, context: D::Context, ) -> PushResult<D>

Source

pub fn write_registered_with( &self, file: IoTargetKey, offset: u64, span: RegisteredSpan, tag: Tag<'_, D::Ids>, context: D::Context, options: WriteOptions<D::Ids>, ) -> PushResult<D>

Source

pub fn read_registered( &self, file: IoTargetKey, offset: u64, span: RegisteredSpan, context: D::Context, ) -> PushResult<D>

Source

pub fn read_registered_with( &self, file: IoTargetKey, offset: u64, span: RegisteredSpan, context: D::Context, options: ReadOptions<D::Ids>, ) -> PushResult<D>

Auto Trait Implementations§

§

impl<D> !Freeze for DeliveryHandle<D>

§

impl<D> RefUnwindSafe for DeliveryHandle<D>

§

impl<D> Send for DeliveryHandle<D>
where Mutex<Option<D>>: Send,

§

impl<D> Sync for DeliveryHandle<D>
where Mutex<Option<D>>: Sync,

§

impl<D> Unpin for DeliveryHandle<D>
where Mutex<Option<D>>: Unpin,

§

impl<D> UnsafeUnpin for DeliveryHandle<D>

§

impl<D> UnwindSafe for DeliveryHandle<D>
where Mutex<Option<D>>: UnwindSafe,

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, 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, 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.