pub struct ControlHandle<Req, Rsp> {
pub producer: Producer<Req>,
pub consumer: Consumer<Rsp>,
pub backpressure: Arc<BackpressureController>,
pub req_wake: Arc<WakePair>,
pub rsp_wake: Arc<WakePair>,
}Expand description
Handle held by the Control Plane (Tokio).
Fields§
§producer: Producer<Req>Send requests to the Data Plane.
consumer: Consumer<Rsp>Receive responses from the Data Plane.
backpressure: Arc<BackpressureController>Backpressure state for the request queue.
req_wake: Arc<WakePair>Wakers for the request channel.
rsp_wake: Arc<WakePair>Wakers for the response channel.
Implementations§
Source§impl<Req, Rsp> ControlHandle<Req, Rsp>
impl<Req, Rsp> ControlHandle<Req, Rsp>
Sourcepub fn try_send_request(&mut self, req: Req) -> Result<()>
pub fn try_send_request(&mut self, req: Req) -> Result<()>
Try to send a request to the Data Plane.
On success, signals the consumer wake eventfd so the TPC core wakes up. Updates backpressure state based on queue utilization.
Sourcepub fn try_recv_response(&mut self) -> Result<Rsp>
pub fn try_recv_response(&mut self) -> Result<Rsp>
Try to receive a response from the Data Plane.
On success, signals the producer wake eventfd so the TPC core knows there’s space for more responses.
Sourcepub fn drain_responses(&mut self, buf: &mut Vec<Rsp>, max: usize) -> usize
pub fn drain_responses(&mut self, buf: &mut Vec<Rsp>, max: usize) -> usize
Drain up to max responses into the buffer.
Sourcepub fn pressure(&self) -> PressureState
pub fn pressure(&self) -> PressureState
Current backpressure state.
Sourcepub fn response_wake_fd(&self) -> RawFd
pub fn response_wake_fd(&self) -> RawFd
Raw fd for the response-available signal (register with Tokio’s AsyncFd).
Sourcepub fn request_space_fd(&self) -> RawFd
pub fn request_space_fd(&self) -> RawFd
Raw fd for the request-space-available signal.
Auto Trait Implementations§
impl<Req, Rsp> Freeze for ControlHandle<Req, Rsp>
impl<Req, Rsp> !RefUnwindSafe for ControlHandle<Req, Rsp>
impl<Req, Rsp> Send for ControlHandle<Req, Rsp>
impl<Req, Rsp> Sync for ControlHandle<Req, Rsp>
impl<Req, Rsp> Unpin for ControlHandle<Req, Rsp>
impl<Req, Rsp> UnsafeUnpin for ControlHandle<Req, Rsp>
impl<Req, Rsp> !UnwindSafe for ControlHandle<Req, Rsp>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more