Skip to main content

OverflowPushHandler

Struct OverflowPushHandler 

Source
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:

  1. Decode the postcard-encoded OverflowPush.
  2. Look up sender_caps in capability_index keyed on request.sender_node_id.
  3. Run super::admission::should_accept_overflow_from against the live local_caps snapshot + the sender’s caps + the chunk size.
  4. On Admit: build a super::blob_ref::BlobRef::small from (blob_hash, size_bytes) and call super::adapter::BlobAdapter::prefetch — this opens the chunk channel with replication armed and the existing per-chunk replication runtime pulls the bytes from whoever advertises causal:<hash> (typically the sender). Returns OverflowPushAck::Accepted on success, OverflowPushAck::OpenChunkFailed on local-plumbing error.
  5. On Reject: wrap the typed OverflowReject in OverflowPushAck::Rejected and 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

Source

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.

Source

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

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,

Process one request and return the response payload. The fold spawns this in a tokio task; the fold itself doesn’t block on it. Handlers should respect ctx.cancellation for cooperative early-abort.

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more