pub struct AdminClient { /* private fields */ }Expand description
A connected admin client. Sends AdminRequestKind requests and
awaits the matching AdminResponseBody.
Implementations§
Source§impl AdminClient
impl AdminClient
Sourcepub async fn connect(caller: PrincipalId) -> Result<Self>
pub async fn connect(caller: PrincipalId) -> Result<Self>
Connect to the running daemon, authenticate via the existing
handshake, and bind the client to caller. Every outbound
request stamps IpcMessage.principal = caller so the kernel’s
resolve_caller reads it for Layer 5/6 capability checks.
§Errors
Returns an error if the socket file is missing (no daemon), connection fails, or the handshake is rejected.
Sourcepub const fn with_timeout(self, timeout: Duration) -> Self
pub const fn with_timeout(self, timeout: Duration) -> Self
Override the response read timeout. Used by tests.
Sourcepub const fn caller(&self) -> &PrincipalId
pub const fn caller(&self) -> &PrincipalId
Borrow the principal this client stamps on outbound messages.
Sourcepub async fn request(
&mut self,
kind: AdminRequestKind,
) -> Result<AdminResponseBody>
pub async fn request( &mut self, kind: AdminRequestKind, ) -> Result<AdminResponseBody>
Send an admin request and await the matching response.
The request_id is generated as a fresh UUID v4 and echoed
back on the response. Messages with a different topic or a
non-matching request_id are dropped while we wait.
§Errors
Returns an error if the request fails to serialize, the send fails, the response is not received within the timeout, or the connection drops before a matching response arrives.