tephra-types 0.1.3

Shared vocabulary types for tephra: positions, event type/tag names, and the query model. Pure data and validation, no I/O.
Documentation

tephra-types

Crates.io Documentation License

Shared vocabulary types for tephra: the concepts a client and the storage engine both speak.

This crate is pure data and validation with no I/O and no storage machinery, so a client can link it (and the wire protocol) without pulling in the engine. It holds:

  • Position: the dense, monotonic, 1-based event position (position 0 is the "before everything" sentinel).
  • EventType, Tag, and the sorted, deduplicated Tags set, validated on construction.
  • The query model: Query, QueryItem, and AppendCondition (OR across items, AND within an item's tags).

It is the single source of truth for name and tag validation across the workspace.

Example

use tephra_types::{AppendCondition, Query, QueryItem, Tag, Tags};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // A query item matches events carrying all of the listed tags.
    let item = QueryItem::with_tags(Tags::new([Tag::new("course:c1")?])?);
    let query = Query::item(item);

    // The same query guards an append: fail if any matching event already exists.
    let _condition = AppendCondition::new(query);
    Ok(())
}

Related crates

  • tephra: the embedded event store engine.
  • tephra-proto: the wire protocol built on this vocabulary.
  • tephra-client: a synchronous client speaking this vocabulary.

License

Licensed under the Apache License, Version 2.0.