Skip to main content

Module adopt

Module adopt 

Source
Expand description

One-call broker adoption: negotiate → dial → ready-to-talk client (#433 R1).

connect_to_backend returns a raw BackendConnection — a bare socket the consumer must still wrap in a FrameClient before it can send a single request. Every consumer (zccache, soldr, clud, fbuild) repeats the same three lines: check the disable env, call connect_to_backend, wrap the stream. BrokerSession::adopt is that recipe, owned once here so the contract is a single call:

use running_process::broker::adopt::BrokerSession;
use running_process::broker::client::ConnectBackendRequest;

let request = ConnectBackendRequest::new("broker.sock", "zccache", "1.11.20", "1.11.20");
let mut session = BrokerSession::adopt(request)?;
let reply = session.request(0x7A63, b"ping".to_vec())?;
assert_eq!(reply.payload, b"pong");

The blocking BrokerSession is the wire-of-record; the async [AsyncBrokerSession] (feature client-async, #433 R3) is a thin spawn_blocking wrapper so tokio daemons get the same one-call adoption without re-implementing the negotiation against AsyncRead/AsyncWrite.

Structs§

BrokerSession
A negotiated, dialed, and framed broker backend connection.
OwnedBackendIo
A live negotiated backend socket handed back as an owned OS handle (#720).

Enums§

AdoptError
Errors from BrokerSession::adopt / AsyncBrokerSession::adopt.
IntoBackendIoError
Errors from BrokerSession::into_backend_io / [AsyncBrokerSession::into_backend_io].