Expand description
GTS (Graph Transport Substrate) format engine — docs/GTS-SPEC.md Draft v0.3.
A GTS file is a CBOR Sequence of one or more segments (#3.1), each an
append-only log: a Header followed by frames chained by BLAKE3 content-id
("id"/"prev", §6/§9.1). reader::read verifies the chain and folds
the log into a container fold (§7.5), degrading undecodable frames to
opaque nodes (§7.6) instead of aborting — the reader is total.
This crate is the Rust counterpart of the Python reference oracle
(src/purrdf_tools/gts/); both are gated against the same frozen
language-neutral conformance corpus in vectors/ (§18).
The Python side keeps the producer; this crate owns the format engine.
§Examples
Write a tiny GTS log to memory with writer::Writer and fold it back
with reader::read:
use purrdf_gts::model::{Term, TermKind};
use purrdf_gts::reader::read;
use purrdf_gts::writer::Writer;
let iri = |value: &str| Term {
kind: TermKind::Iri,
value: Some(value.to_string()),
datatype: None,
lang: None,
direction: None,
reifier: None,
};
let terms = vec![
iri("http://example.org/cat"),
iri("http://example.org/name"),
Term {
kind: TermKind::Literal,
value: Some("Purr".to_string()),
datatype: None,
lang: Some("en".to_string()),
direction: None,
reifier: None,
},
];
let mut writer = Writer::new("purrdf.gts");
writer.add_terms(&terms);
writer.add_quads(&[(0, 1, 2, None)]); // (s, p, o) term ids; None = default graph
let bytes = writer.into_bytes();
let graph = read(&bytes, true, None);
assert_eq!(graph.terms, terms);
assert_eq!(graph.quads, [(0, 1, 2, None)]);
assert!(graph.diagnostics.is_empty());Re-exports§
pub use policy::ProfileFinding;pub use policy::Severity;pub use policy::SignatureTrust;pub use policy::TrustPolicy;pub use policy::evaluate_profile_policy;pub use policy::signature_trust;pub use visual_hashing as emojihash;
Modules§
- codec
- The GTS transform catalog (§8) — mirror of
src/purrdf_tools/gts/codec.py. - compact
- Streamable compaction (GTS-SPEC §10.1): re-author the ordering, only the
ordering — mirror of
packages/gts/src/gts/compact.py. - cose
- COSE_Sign1 (detached payload, EdDSA/Ed25519) over a frame id — GTS-SPEC §9.2.
- dict
- Deterministic in-band pack dictionaries for the GTS
zstddctcodec (GTS-SPEC §5 header"dct", §8.5zstddctparameter). - event_
stream - Bridge a GTS file onto the permissive RDF 1.2 ingestion protocol
(
purrdf_events::RdfEventSink). - examples
- Runnable application examples built only on the core GTS crate.
- files
- Files-profile pack/unpack/diff logic for GTS archives (§13.2, §14.2).
- from_
tar - Tar stream import into files-profile-v2 GTS archives.
- mmr
- Merkle-Mountain-Range commitments for
index.mmrand detached proof JSON. - model
- In-memory data model for the folded graph — mirror of
src/purrdf_tools/gts/model.py. - nested
- Bounded nested-GTS discovery for Full Reader callers.
- openpgp
- Minimal OpenPGP reader for Ed25519 armored public/secret keys (§9.2).
- policy
- Trust and profile-policy checks layered above core GTS validity.
- reader
- The GTS reader: parse a CBOR Sequence, verify the id/prev chain, fold the
log — mirror of
src/purrdf_tools/gts/reader.py. - replication
- Replication inventory helpers for the Rust CLI.
- segment_
decode - Target-agnostic GTS segment decode + two-phase resolution core.
- stream
- The spec-owned
streamvocabulary (GTS-SPEC §13.3) — mirror ofpackages/gts/src/gts/stream.py. - tar
- Tar stream import/export for files-profile-v2 GTS archives.
- ulid
- Dependency-free ULID support for deterministic GTS-generated identifiers.
- verify
- High-level embedded-key verification helpers.
- wire
- Wire primitives: deterministic CBOR, BLAKE3 content-ids, and the id/prev
rule — mirror of
src/purrdf_tools/gts/wire.py. - writer
- A GTS writer: build frames, maintain the id/prev chain, emit a CBOR Sequence.