Repository navigation
datagram@3 and comline@2 in the runtime (runtime#15, phase 2) - #80
Merged
Merged
Conversation
…hake (runtime#15) datagram@3 addresses a call by its protocol's and function's wire numbers, both varints (calls = by_id); replies are datagram@2's, which is unchanged. comline@2 compares what core's facts record instead of the whole IR: the package id, encodings by parameter hash, and per protocol its number, line and shape hash and its functions' numbers. Lines decide; a shape that differs at the same version goes to same_version_differs. The parameters scope, newer_consumer, same_version_differs and exchange (offer or symmetric, a wire parameter) are all implemented, sans-IO on Comline2 and over blocking and async transports on Comline2Handshake. Refusals carry a stable reason code and the refusing side (RuntimeError::Refused); calls the peer can't take fail locally through Negotiated::check_call (RuntimeError::Unavailable). Conformance spec 0.4: features framing-datagram3 and handshake-comline2, ops comline2_message and comline2_negotiate, profiles datagram@3 and comline@2, and vectors for every parameter value and every reason code. Neither is a default yet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2 of
comline@2(runtime#15): the runtime side. Neitherdatagram@3norcomline@2becomes a default here; that is phase 3, in core. Generators are phase 4.datagram@3datagram@2with a call addressed by wire numbers (calls = by_id):[0][protocol varint][function varint][request_id u64 LE][params…][1][protocol varint][request_id u64 LE][envelope…], the same asdatagram@2Both numbers are
u16s written as shortest-form LEB128 (1–3 bytes).datagram@2is unchanged. The new type iscontract::Datagram3Framing.comline@2The new module is
comline_runtime::comline2.Comline2holds the sans-IO steps, andComline2Handshakeruns them as aHandshake/AsyncHandshake. It follows the decisions recorded in runtime#15:Parameters:
scope = protocol | package,newer_consumer = degrade | refuse,same_version_differs = refuse | warnandexchange = offer | symmetric.exchangeis a wire parameter. Each hello carries it, and the handshake encoding's parameter hash covers it.Carried: the package id (16 bytes) and the package version. Per protocol: its number, its line and a 128-bit shape hash, plus the function numbers. Per encoding: its kind and a 128-bit parameter hash, which covers the name.
Lines decide. If the shape differs at the same package version,
same_version_differsdecides.Messages: every message starts
"CO",2, type.comline2::Message.Exchanges:
offer: Hello →, ← Answer (per offered protocol: accepted, with its missing functions, or refused with a reason), Verdict →.symmetric: Hello ⇄, Verdict ⇄.Refusals: each one carries a stable reason code and the refusing side. They surface as
RuntimeError::Refused { reason, side }. The new type iscontract::Reason:malformedhandshake_version(e.g. acomline@1frame)exchange_mismatchpackage_mismatchencoding_mismatchline_mismatchsame_version_differsnewer_consumerunknown_protocolscope = package)Degrade: after the handshake,
Comline2Handshake::negotiated()gives aNegotiated.check_call(protocol, function)returnsRuntimeError::Unavailablefor a function the peer lacks, or for a protocol that was refused. Generated code calls it before writing, so nothing reaches the wire.Unavailablecarries no fields. That keepsRuntimeErrorat 4 bytes, which thepacked@1decode path depends on.Conformance, spec 0.4
framing-datagram3andhandshake-comline2.comline2_message(encode and decode) andcomline2_negotiate(decode only). The negotiate op gives back the reply message and the result.datagram@3(calls = by_id,errors = by_ordinal) andcomline@2(schema_agreement,encoding_agreement).comline-referenceanswers the new ops and listsdatagram@3.Not here
runtime/ffi): neither speaksdatagram@3orcomline@2yet, and the TS runtime runs on that wasm build. So comline-typescript can't claim the new features until the ABI gains them.