corro-client
Async Rust client for the Corrosion HTTP API.
This crate is the recommended way to talk to a running Corrosion agent from
Rust. It speaks the JSON over HTTP/2 protocol exposed at /v1/queries,
/v1/subscriptions, /v1/updates, /v1/transactions and /v1/migrations,
and re-exports the wire-level types from
corro-api-types.
Clients
Three client types are provided:
CorrosionApiClient— the lowest-level handle, wrapping a singlereqwest::Clientpointed at oneSocketAddr.CorrosionClient— adds a localsqlite_pool::RusqlitePoolfor reading directly from the on-disk SQLite database without going through the HTTP API. Dereferences toCorrosionApiClient.CorrosionPooledClient— accepts a list of agent addresses, resolves them through DNS and retries failed requests against the next available peer with configurable stickiness.
All read endpoints return futures::Streams (QueryStream,
SubscriptionStream, UpdatesStream) that yield
corro_api_types::TypedQueryEvent / corro_api_types::TypedNotifyEvent
frames. Subscriptions automatically reconnect with the last seen ChangeId
when the underlying HTTP connection drops, so most callers can simply
iterate the stream and ignore transient network failures.
Example
use CorrosionApiClient;
use Statement;
use StreamExt;
# async
License
Licensed under the Apache License, Version 2.0.