pub struct EntryDelivery<D: DurableRing<Readiness = Event> + Send + 'static> { /* private fields */ }Expand description
The Model A front end: owns an instance and hands its entries, one at a time and in queue
order, to a handler on thread-pool threads. Derefs to the DeliveryHandle through which the
instance’s operations are reached. For an instance whose readiness signal is an Event,
which it waits on through the thread pool.
§The handler
Called with a DeliveryEvent: each entry, in queue order, and a failure of the instance’s
pop when it has one to report, which a handler that ignores is a delivery that stalls
without saying so. Called on a pool thread, never twice at once, with the instance’s lock released. It must not
panic – a panic unwinds into the thread pool’s callback and aborts the process – and while it
runs no further entry is delivered, so a handler that blocks holds up delivery, and holds up
into_inner and drop, which wait for it.
§Ending
Drop, close and into_inner all quiesce the delivery
first: no handler call is running or will start (DI-2.7 point 5), so none runs once they have
returned. Drop then drops the instance, and close closes it, each discarding any entry not yet
delivered; into_inner hands the instance back with those entries still queued, so it can be
popped directly or closed.
Implementations§
Source§impl<D: DurableRing<Readiness = Event> + Send + 'static> EntryDelivery<D>
impl<D: DurableRing<Readiness = Event> + Send + 'static> EntryDelivery<D>
Sourcepub fn new<F>(
ring: D,
on_entry: F,
env: Option<&mut CallbackEnviron<'_>>,
) -> Result<Self, DeliverySetupError<D, F>>
pub fn new<F>( ring: D, on_entry: F, env: Option<&mut CallbackEnviron<'_>>, ) -> Result<Self, DeliverySetupError<D, F>>
Take ring and deliver its entries to on_entry, on the default thread pool, or on the
pool and priority env selects.
Entries already queued when the ring is handed over are delivered: the readiness signal may already have been consumed, so this arms the wait and then sets the signal itself.
§Errors
A DeliverySetupError handing back the instance and the handler, when duplicating the
readiness signal, creating the thread-pool wait, or setting the signal fails. Only the first
is reached by a test: the others fail when the process cannot get another handle or the
thread pool cannot create a wait.
Sourcepub fn into_inner(self) -> D
pub fn into_inner(self) -> D
Quiesce the delivery and hand back the instance, with any entry not yet delivered still in its queue.
Methods from Deref<Target = DeliveryHandle<D>>§
Sourcepub fn add_target(
&self,
key: IoTargetKey,
target: D::Target,
) -> Result<(), AddTargetError<D::Target>>
pub fn add_target( &self, key: IoTargetKey, target: D::Target, ) -> Result<(), AddTargetError<D::Target>>
Sourcepub fn remove_target(
&self,
key: IoTargetKey,
) -> Result<D::Target, RemoveTargetError<D::Ids>>
pub fn remove_target( &self, key: IoTargetKey, ) -> Result<D::Target, RemoveTargetError<D::Ids>>
Sourcepub fn default_lineage(&self) -> HandleOf<D>
pub fn default_lineage(&self) -> HandleOf<D>
Sourcepub fn mint_lineage(&self, description: Option<String>) -> HandleOf<D>
pub fn mint_lineage(&self, description: Option<String>) -> HandleOf<D>
Sourcepub fn lineages(&self) -> Vec<LineageInfo<D::Ids>>
pub fn lineages(&self) -> Vec<LineageInfo<D::Ids>>
Sourcepub fn end_lineage(
&self,
handle: HandleOf<D>,
) -> Result<(), EndLineageError<D::Ids>>
pub fn end_lineage( &self, handle: HandleOf<D>, ) -> Result<(), EndLineageError<D::Ids>>
Sourcepub fn retire_lineage(
&self,
handle: HandleOf<D>,
) -> Result<(), RetireLineageError<D::Ids>>
pub fn retire_lineage( &self, handle: HandleOf<D>, ) -> Result<(), RetireLineageError<D::Ids>>
Sourcepub fn write(
&self,
file: IoTargetKey,
offset: u64,
buffer: D::Buffer,
tag: Tag<'_, D::Ids>,
context: D::Context,
) -> PushResult<D>
pub fn write( &self, file: IoTargetKey, offset: u64, buffer: D::Buffer, tag: Tag<'_, D::Ids>, context: D::Context, ) -> PushResult<D>
Sourcepub fn write_with(
&self,
file: IoTargetKey,
offset: u64,
buffer: D::Buffer,
tag: Tag<'_, D::Ids>,
context: D::Context,
options: WriteOptions<D::Ids>,
) -> PushResult<D>
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>
Sourcepub fn read(
&self,
file: IoTargetKey,
offset: u64,
buffer: D::Buffer,
context: D::Context,
) -> PushResult<D>
pub fn read( &self, file: IoTargetKey, offset: u64, buffer: D::Buffer, context: D::Context, ) -> PushResult<D>
Sourcepub fn read_with(
&self,
file: IoTargetKey,
offset: u64,
buffer: D::Buffer,
context: D::Context,
options: ReadOptions<D::Ids>,
) -> PushResult<D>
pub fn read_with( &self, file: IoTargetKey, offset: u64, buffer: D::Buffer, context: D::Context, options: ReadOptions<D::Ids>, ) -> PushResult<D>
Sourcepub fn make_durable_through(
&self,
through: Tag<'_, D::Ids>,
) -> Result<DurabilityRequest<D::Ids>, SealError<D::Ids>>
pub fn make_durable_through( &self, through: Tag<'_, D::Ids>, ) -> Result<DurabilityRequest<D::Ids>, SealError<D::Ids>>
Sourcepub fn durable_through(
&self,
lineage: Lin<D>,
) -> Result<Option<EpochIdOf<D>>, UnknownLineage<D::Ids>>
pub fn durable_through( &self, lineage: Lin<D>, ) -> Result<Option<EpochIdOf<D>>, UnknownLineage<D::Ids>>
Sourcepub fn sealed_through(
&self,
lineage: Lin<D>,
) -> Result<Option<EpochIdOf<D>>, UnknownLineage<D::Ids>>
pub fn sealed_through( &self, lineage: Lin<D>, ) -> Result<Option<EpochIdOf<D>>, UnknownLineage<D::Ids>>
Sourcepub fn epoch_state(
&self,
epoch: Epoch<D::Ids>,
) -> Result<EpochState<D::Ids>, UnknownLineage<D::Ids>>
pub fn epoch_state( &self, epoch: Epoch<D::Ids>, ) -> Result<EpochState<D::Ids>, UnknownLineage<D::Ids>>
Sourcepub fn resolve(
&self,
items: Vec<(TokenOf<D>, Resolution)>,
) -> Result<(), ResolveError<D::Ids>>
pub fn resolve( &self, items: Vec<(TokenOf<D>, Resolution)>, ) -> Result<(), ResolveError<D::Ids>>
Sourcepub fn import_failure(
&self,
scope: ImportScope<D::Ids>,
) -> Result<Imported<D::Ids>, UnknownLineage<D::Ids>>
pub fn import_failure( &self, scope: ImportScope<D::Ids>, ) -> Result<Imported<D::Ids>, UnknownLineage<D::Ids>>
Sourcepub fn failures(&self) -> Vec<FailureInfo<D::Ids>>
pub fn failures(&self) -> Vec<FailureInfo<D::Ids>>
Sourcepub fn take_token(&self, failure: FailureIdOf<D>) -> Option<TokenOf<D>>
pub fn take_token(&self, failure: FailureIdOf<D>) -> Option<TokenOf<D>>
Sourcepub fn with_registered_buffer<R>(
&self,
i: u32,
f: impl FnOnce(&[u8]) -> R,
) -> Result<R>
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
Sourcepub fn with_registered_buffer_mut<R>(
&self,
i: u32,
f: impl FnOnce(&mut [u8]) -> R,
) -> Result<R>
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.