zenkey-model
The session-free half of zk2,
typed interface contracts over Zenoh: everything about
keys and contracts that can be decided from files, with no Zenoh session.
Build scripts, CI tools, the zenkey
runtime and the conformance runners stand on it.
- Keys (
grammar,template,slug): thezk2/grammar as typed values overzenoh_keyexpr::OwnedKeyExpr, resource templates with most-literal-first precedence, and injective slugging. - Contracts (
authoring,contract,diag): the TOML authoring format, with defaults expanded, types resolved (protobuf throughprotox, JSON Schema, packed types, raw media types), and every lint reported with a stable code. - Identity (
canonical,bundle,history,compat): the canonical JSON form, its fingerprint, the bundle container verified Merkle-style, the append-only.historyof published revisions, and the compatibility classifier between two revisions. - The rest of the spec that needs no session: a late joiner's merge, the zk2c envelope, and the session-free half of each profile.
Starting
An application rarely depends on this crate directly: it writes a
contract, generates its typed module with
zenkey-build in build.rs,
and brings a service up with zenkey::ServiceBuilder::new
(zenkey's README has the example).
This crate is what both stand on, re-exported as zenkey::model.
Its zk2 binary is the contract CI:
Changes since 0.20
- The wire breaks 0.20's. A state GET is answered by snapshot
(core 0.100, #977):
one per collection, in pages of form 7, read under consolidation
None, merged per key, with the omission rule over a complete snapshot.collectionreads the pages (Heard,hear,Page::members,omit) andseed::apply_snapshotapplies the rule to what a late joiner holds. Areply_delon a member of a collection answered by snapshot is no owner's answer (collection::stray_reply_del,STRAY_REPLY_DEL). Afreshness.v2heartbeat's time counts from the catalog's epoch (freshness.v20.6, #1080). - The bare wire is gone (core 0.99,
#985's C4d): a
call's reply or error under any
Encodingbutzenoh/bytescarries no form.envelope::{Envelope, EnvelopeError, decode, encode, JSON, CBOR, PROTOBUF},Detail::raw,Detail::raw_bytesandErrorReading::Envelopeare removed. Read a reply error withenvelope::read_errororErrorForm::read: one that is no error form is the transport's.wire::read_valuereturnsResult<wire::Envelope, FormRefusal>in place of aReading, whosePlainwas the bare wire:FormRefusal::Encodingunder anotherEncoding,FormRefusal::Formfor the parse's refusal, andFormRefusal::reasonto name either.
- The authoring format and the canonical form did not move: a contract that lints under 0.20 lints under 0.21, at the same fingerprint.
What 0.21 does not promise
zk2c, the bandwidth-first wire (epic #975), is not finished. Two things under 0.21 are still moving, and a 0.22 may break either:
- The authoring format and the canonical form a fingerprint is taken over. A contract that lints under 0.21 may need editing under 0.22, and its fingerprint may change.
- The wire. An event's key is to end in its run and seq in place of a ULID (#980's C2), and the rest of #975 follows. The keys, the envelope and the forms this crate reads and writes move with it.
A 0.21.x patch release changes neither.
Zenoh's unstable API: none. The only zenoh crate this one depends on
is zenoh-keyexpr.
Documentation
docs/zk2/: the design record (architecture.md, r4).examples/zk2/README.md: the authoring format.spec/: the rules.spec/contract.schema.jsonand thespec/conformance/fixtures come from this crate.- Issues: git.marcpardo.eu/marcpardo/zenkey. The GitHub repository is a mirror.
MIT.