pub struct OverflowPushHandler {
pub mesh: Arc<MeshNode>,
pub adapter: Arc<MeshBlobAdapter>,
}Expand description
Receive-side handler for the overflow nRPC. Implements
cortex::RpcHandler so it slots into MeshNode::serve_rpc
(under the OVERFLOW_PUSH_SERVICE service name). On each
incoming request:
- Decode the postcard-encoded
OverflowPush. - Look up
sender_capsincapability_indexkeyed onrequest.sender_node_id. - Run
super::admission::should_accept_overflow_fromagainst the livelocal_capssnapshot + the sender’s caps + the chunk size. - On Admit: build a
super::blob_ref::BlobRef::smallfrom(blob_hash, size_bytes)and callsuper::adapter::BlobAdapter::prefetch— this opens the chunk channel with replication armed and the existing per-chunk replication runtime pulls the bytes from whoever advertisescausal:<hash>(typically the sender). ReturnsOverflowPushAck::Acceptedon success,OverflowPushAck::OpenChunkFailedon local-plumbing error. - On Reject: wrap the typed
OverflowRejectinOverflowPushAck::Rejectedand return.
The handler holds Arc<MeshNode> so it reads live local
caps + the capability index at each call rather than a
build-time snapshot. Toggling overflow_enabled on the
adapter is observable immediately on the next inbound
push.
Fields§
§mesh: Arc<MeshNode>Reference to the local mesh node. Used for the
capability-index lookup + the local-caps snapshot.
Holds an Arc rather than a borrow because the
handler is registered into the nRPC fold which owns
it via Arc<dyn RpcHandler> — the handler outlives
any single tick.
adapter: Arc<MeshBlobAdapter>The local blob adapter. The handler calls
adapter.prefetch(BlobRef) on Admit to open the
chunk channel. Held by Arc for the same reason as
mesh; cheap to clone (the adapter is Arc-internal
throughout).
Implementations§
Source§impl OverflowPushHandler
impl OverflowPushHandler
Sourcepub fn new(mesh: Arc<MeshNode>, adapter: Arc<MeshBlobAdapter>) -> Self
pub fn new(mesh: Arc<MeshNode>, adapter: Arc<MeshBlobAdapter>) -> Self
Construct a handler. Operators wire this into the
receiver-side via
crate::adapter::net::MeshNode::serve_overflow_push.
Sourcepub async fn handle(&self, request: OverflowPush) -> OverflowPushAck
pub async fn handle(&self, request: OverflowPush) -> OverflowPushAck
Pure typed handler logic. Decoded request goes in,
typed ack comes out. Separate from the
crate::adapter::net::cortex::RpcHandler impl so
tests can drive the admission path without
constructing an crate::adapter::net::cortex::RpcContext.
Reads live user_caps_snapshot + capability-fold
state on each call, so an operator toggling
overflow_enabled on the local node is observed by
the next inbound push.
Trait Implementations§
Source§impl RpcHandler for OverflowPushHandler
impl RpcHandler for OverflowPushHandler
Source§fn call<'life0, 'async_trait>(
&'life0 self,
ctx: RpcContext,
) -> Pin<Box<dyn Future<Output = Result<RpcResponsePayload, RpcHandlerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn call<'life0, 'async_trait>(
&'life0 self,
ctx: RpcContext,
) -> Pin<Box<dyn Future<Output = Result<RpcResponsePayload, RpcHandlerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
ctx.cancellation for
cooperative early-abort.