pub struct ClientRegistry { /* private fields */ }Expand description
Per-worker registry of configured upstream clients, keyed by [grpc.clients.<name>]
name. Built once per worker run(); each entry lazily opens its channel on first
call. Clients whose descriptor pool fails to build are logged and omitted (a call
to them returns UNIMPLEMENTED), rather than crashing the worker.
Implementations§
Source§impl ClientRegistry
impl ClientRegistry
Sourcepub fn build(configs: &HashMap<String, ClientConfig>) -> Self
pub fn build(configs: &HashMap<String, ClientConfig>) -> Self
Build the registry from [grpc.clients.*]. Never fails as a whole: a client
with no usable descriptors is skipped with a warning.
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub async fn call(&self, env: ClientCallEnvelope) -> Value
pub async fn call(&self, env: ClientCallEnvelope) -> Value
Execute one grpc.client.call. Returns a JSON value: { "message": <DTO> }
on success, or { "__grpc_status", "__grpc_message" } for any gRPC/transport
failure (business status passed through; transport → UNAVAILABLE(14);
client deadline → DEADLINE_EXCEEDED(4)). Never returns Err for a call
outcome — only truly internal encode failures surface as a status too.
Sourcepub async fn open_stream(&self, env: ClientStreamEnvelope) -> StreamConn
pub async fn open_stream(&self, env: ClientStreamEnvelope) -> StreamConn
Open a server-streaming call (phase 88b). Returns a StreamConn whose
inbound stream yields one JSON frame per upstream message: { "message": … }
for a decoded DTO, or { "__grpc_status", "__grpc_message" } for a decode
failure or a non-OK trailing status — the same convention the unary call
uses, so the PHP side maps a status frame to GrpcException. Never fails at
the handler level: setup errors (unknown client/method, bad request, connect)
surface as a single status frame, so PHP’s foreach always sees the outcome.
Auto Trait Implementations§
impl !RefUnwindSafe for ClientRegistry
impl !UnwindSafe for ClientRegistry
impl Freeze for ClientRegistry
impl Send for ClientRegistry
impl Sync for ClientRegistry
impl Unpin for ClientRegistry
impl UnsafeUnpin for ClientRegistry
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request