pub struct UdsRpcClient { /* private fields */ }Expand description
See module docs.
Implementations§
Source§impl UdsRpcClient
impl UdsRpcClient
Sourcepub fn with_stream_frame_timeout(self, timeout: Duration) -> Self
pub fn with_stream_frame_timeout(self, timeout: Duration) -> Self
Override the per-frame stream budget.
Why: STREAM_FRAME_TIMEOUT is fifteen minutes, and
session_events_tests::session_stream_silence_is_bounded_not_infinite
has to observe the budget expire. Spending fifteen real minutes to
prove a bound exists is not a test; a paused clock cannot help either,
because the reader is parked on a socket read rather than on a timer.
Sourcepub fn socket(&self) -> &Path
pub fn socket(&self) -> &Path
The socket this client dials — read by callers building an error message or a reconnect, never to bypass this client.
Sourcepub async fn call(
&self,
method: &str,
params: Value,
) -> Result<Value, EngineError>
pub async fn call( &self, method: &str, params: Value, ) -> Result<Value, EngineError>
Call method with params, waiting (bounded by
DEFAULT_CALL_TIMEOUT) for the one response frame.
Why: the single call every session.*/task.*/workstream.* RPC in
this engine goes through.
What: mints a monotonic id, writes one JSON-RPC frame, and returns
Ok(result) or maps the JSON-RPC error object onto
EngineError::Rpc. A dial, write, read or decode failure maps onto
EngineError::Transport.
§Errors
EngineError::Transport for a transport failure, EngineError::Rpc
for the daemon’s own error envelope, EngineError::Malformed for a
response carrying neither result nor error.
Test: tests/tui_client_engine.rs::tui_engine_end_to_end_with_http_port_closed.
Sourcepub async fn open_stream<T: DeserializeOwned>(
&self,
method: &str,
params: Value,
) -> Result<FramedStream<T>, EngineError>
pub async fn open_stream<T: DeserializeOwned>( &self, method: &str, params: Value, ) -> Result<FramedStream<T>, EngineError>
Open a streaming call and return its frame reader.
What: sets the "stream": true flag
trusty_common::uds::server’s wire contract negotiates on, and hands
back a FramedStream whose per-frame budget is
STREAM_FRAME_TIMEOUT. A method that does not stream answers one
ordinary response frame, which the reader reports as
UdsRpcError::NotAStream rather than decoding as an item.
§Errors
EngineError::Transport for a dial or write failure. Everything after
the stream opens is reported per frame, by the reader.
Test: tests/tui_client_engine.rs::tui_engine_end_to_end_with_http_port_closed.
Auto Trait Implementations§
impl !Freeze for UdsRpcClient
impl RefUnwindSafe for UdsRpcClient
impl Send for UdsRpcClient
impl Sync for UdsRpcClient
impl Unpin for UdsRpcClient
impl UnsafeUnpin for UdsRpcClient
impl UnwindSafe for UdsRpcClient
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more