mod mailbox

module mailbox

Catalog I/O on a dedicated thread.

The hop loop never owns the RPC executor. Talking is a mailbox: post a request, keep hopping, apply the last answer when it arrives. That is how a cooperative replica stays at least as strong as the same single chain. A blocking recv on the hop thread can only be worse. CatalogClient itself runs RpcSystem on a LocalSet; this queue keeps that work off the hop thread.

Structs and Unions

struct CatalogMailbox

Owns one CatalogClient on an I/O thread.

Implementations

impl CatalogMailbox

Functions

fn drain(&self)

Wait for every job posted before this call to finish.

The queue is FIFO on one thread, so an empty job that answers is a barrier. A caller that posted work and then wants to read what the coordinator made of it has no other way to know it landed.

fn exec<T, F>(&self, work: F) -> T
where
    T: Send + 'static,
    F: FnOnce(&mut CatalogClient) -> T + Send + 'static

Run one client call and wait for it. Tests and rare control paths.

fn post<F>(&self, work: F)
where
    F: FnOnce(&mut CatalogClient) + Send + 'static

Queue work. The hop thread does not wait.

fn post_surface_evidence(&self, message: SurfaceEvidenceMessage)

Queue one surface-evidence reply. The hop thread does not wait.

The message keeps the source key from the block that produced it.

fn spawn(mut client: CatalogClient) -> Self

Move the client onto its I/O thread.

fn surface_evidence(&self) -> Arc<Mutex<SurfaceEvidenceBook>>

Book of surface-evidence messages applied by this mailbox.

Traits implemented

impl Drop for CatalogMailbox