tephra-client 0.1.1

Synchronous, blocking TCP client for a tephra event store, speaking the length-prefixed protobuf protocol
docs.rs failed to build tephra-client-0.1.1
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.

tephra-client

Crates.io Documentation License

A synchronous, blocking TCP client for a tephra event store, speaking the length-prefixed protobuf protocol.

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.

It exposes append, one-shot reads, and live subscriptions (catch-up followed by a live tail, with no gap or duplicate at the boundary).

Example

use tephra_client::{Client, Event, Position, Query, QueryItem, Tag, Tags};

let mut client = Client::connect("127.0.0.1:9000")?;

// Append an event: type, tags, and an opaque payload. `None` means no append condition.
let event = Event::new("CourseOpened", &["course:c1"], br#"{"course":"c1","seats":30}"#.to_vec())?;
let result = client.append([event], None)?;
println!("recorded positions {} to {}", result.first, result.last);

// Read every event matching a query, from the beginning.
let query = Query::item(QueryItem::with_tags(Tags::new([Tag::new("course:c1")?])?));
let (events, _watermark) = client.read_all(query, Position::ZERO)?;
for seq in &events {
    println!("{} {}", seq.position(), seq.event().event_type());
}

Subscriptions follow the same query model; see the crate documentation for the subscribe API.

Related crates

License

Licensed under the Apache License, Version 2.0.