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.24
- A face policy keeps the binding's name as it spells it
(#1204).
link::FacePolicy::binding_nameiszm-1.10.2-r2for a policy naming it, beside abindingthat reads it asBinding::Zm1_10_2R1, so what a plan writes for a reader names the release the policy names.- Breaking: a
FacePolicystruct literal needsbinding_name, and two policies that differ only in the release they name are no longer equal (==), where 0.24 found them so.
- Breaking: a
Changes since 0.23
- A later release of the fork names the fork's binding (
link.v20.31 §2.4, #1191).link::Binding::parsetakeszm-1.10.2-r<n>,na decimal from 1 with no leading zero, asBinding::Zm1_10_2R1: its link protocols and its defaults. A plan names the bindingzm-1.10.2-r1. zenoh-modem ships onzm-1.10.2-r2. - A face the near router opens may name a user under
allow(link.v20.32 §2.5). Underdenyit is refused, as before (near_opens_user). Underallowthe plan is drawn, with the warningnear_opens_unauthenticatedatopens:usrpwdauthenticates only the end that opens, so nothing authenticates the far principal, and its subject is selected by the face's link protocols alone. A link whose far end cannot open (an SBD remote dials the ground) is planned this way.- Breaking:
link::CodegainsNearOpensUnauthenticated, so amatchover it without a wildcard arm needs one more.link::Deploymentgainsdefault_allow: bool(the deployment's posture, false by default), so a struct literal without..Default::default()needs it.
- Breaking:
Changes since 0.22
- The wire breaks 0.22's: a 0.22 reader does not read a 0.23 owner's
descriptor. Move a deployment's readers first, then its owners: a
0.23 reader reads a 0.22 owner's descriptor, which states minor 0.
descriptor::InterfaceEntry::minoris anOption<u64>(core 0.107, #1127). An entry states the minor of the revision it names, and none where its owner holds only the bundle, as generated code and the standard profiles do. 0.22 requires the member, and refuses the whole descriptor ("missing fieldminor").- The compact form (core 0.120,
#980's C5):
descriptor::compactencodes and decodes it through a catalog and the revisions it names, anddescriptor::Formtells the two forms apart by theirEncoding. An owner on a first hop given a catalog writes it. 0.22 reads none. - A heartbeat's time may be the ahead time (core 0.113): the owner's
clock guard holds (
heartbeat::Time::Ahead,health::ClockReason::Ahead). A reader before 0.113 refuses it. freshness.v20.8 to 0.14: the owner heartbeat, one put per class of exposure with a group per interface (#1110;heartbeat::Collection::class,freshness::SectionRead::OtherClass), and the standard contract's revision 1.1.- A conditional read (core 0.110,
#986's J1):
an unchanged member is answered by its held stamp alone
(
wire::SampleKind::Get,wire::Refusal::{Held, HeldTag};SampleKind::ALLhas six entries).
- Four profiles' second majors, session-free:
health::v2,alarms::v2,desired::v2andredundancy::v2, each its text's. link.v20.14 to 0.30,link.v10.19 to 0.22:- subjects by user name, the far end opening the face
(#1107;
Face::opens,Deployment::users,Code::NearOpensUser); - the owner heartbeat in the plans
(#1145;
Deployment::owner_heartbeats,Code::OwnerHeartbeatDenied); - zenoh 1.10.2 (#1165;
Binding::Zenoh1_10_2, andBinding: FromStr); - a frame weighed with what zenoh writes beside it
(#1136;
Res::{priority_data, express}), andRes::cardinality.
- subjects by user name, the far end opening the face
(#1107;
- One lint more: E051 refuses a contract that declares a packed type at layout tag 0, a profile-derived type aside (#1152). The authoring format and the canonical form did not move: a contract that lints under 0.22 lints under 0.23, at the same fingerprint, unless E051 refuses it.
- Grown, so a
matchover them or a literal of them needs the new members:desired::Finding::{Escape, RunFields},desired::Invalid::HorizonV1,redundancy::Invalid::{Majors, ExplicitStream}, eightalarms::Reasons (Rebound,Snapshot,SnapshotIncomplete,SnapshotRun,Table,NoWords,NoRecord,Unreadable),arbitration::Event::Read'saskedandredundancy::Holding::Read's fourth field.link::Code's discriminants moved, which only anascast sees. - Moved:
desired::Ended<R = Refusal>takes the refusal's type (#1153), anddesired::{in_force, last_known, refused}take one more type parameter with it.arbitration::Incumbentsisredundancy::Fence(#987's N1). - The repair key (core 0.121 §8.5, #1185):
link::repair_keyandREPAIRS, read againstconformance/repair/keys.json.
What 0.25 does not promise
zk2c, the bandwidth-first wire (epic #975), is not finished. These are still moving under 0.25, and a 0.26 may break them:
- The texts zk2py has not read yet. The independent implementation's rounds (#609) were paused for zenoh-modem's needs. Core 0.120's compact descriptor and archive attachment (#980) link.v2 0.30's batch allowance (#1136) and core 0.121's repair subscription (#1185) are the reference's reading alone, and a round may amend them.
- Owners' defaults that wait for these readers. #986's Q3 and #984's S5 flip an owner's default once 0.23's readers are deployed: readers move first.
- #980's rest: the near side's descriptor size, and the minor.
- The authoring format and the canonical form a fingerprint is taken over. A contract that lints under 0.25 may need editing under 0.26, and its fingerprint may change.
A 0.25.x patch release changes none of them. The rules are the spec's
(spec/core.md,
its version in its header), and a release implements the spec as it
stood when it was cut.
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.