docs.rs failed to build tephra-client-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
A synchronous, blocking TCP client for a tephra event store.
The client speaks clean Rust types: the shared vocabulary from
tephra-types ([Query], [QueryItem], [AppendCondition], [Position],
[EventType], [Tag], [Tags]) plus a friendly owned [Event] and [SequencedEvent].
The wire protobuf types are an implementation detail hidden behind these; the raw wire
module is still available as [proto] for low-level use, but it is not the API.
One request is in flight at a time per [Client] (the server answers a connection's
requests sequentially); open more clients for concurrency.
use tephra_client::{Client, Event, Position, Query};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = Client::connect("127.0.0.1:9000")?;
client.append([Event::new("Enrolled", &["course:c1"], b"{}")?], None)?;
let (events, _watermark) = client.read_all(Query::all(), Position::ZERO)?;
for sequenced in events {
println!("{}: {}", sequenced.position(), sequenced.event().event_type());
}
Ok(())
}