From e13a150d9f96eaed38ab8223d08e352ce6f893b0 Mon Sep 17 00:00:00 2001 From: "glm-5.2" Date: Tue, 23 Jun 2026 13:45:14 +0000 Subject: [PATCH] feat(call): initialize alknet-call crate skeleton (task: call/crate-init) Create crates/alknet-call with Cargo.toml, lib.rs, and module skeletons for the registry (spec, context, registration, env, discovery) and protocol (wire, pending, connection, adapter, abort) subsystems. Add the crate to the workspace members list. Depends on alknet-core (workspace path), irpc (workspace dep), tokio, serde, serde_json, async-trait, tracing, thiserror, uuid, and futures. Implements ProtocolHandler on ALPN alknet/call per docs/architecture/crates/call. --- Cargo.lock | 432 ++++++++++++++++-- Cargo.toml | 1 + crates/alknet-call/Cargo.toml | 25 + crates/alknet-call/src/lib.rs | 10 + crates/alknet-call/src/protocol/abort.rs | 7 + crates/alknet-call/src/protocol/adapter.rs | 8 + crates/alknet-call/src/protocol/connection.rs | 8 + crates/alknet-call/src/protocol/mod.rs | 11 + crates/alknet-call/src/protocol/pending.rs | 7 + crates/alknet-call/src/protocol/wire.rs | 7 + crates/alknet-call/src/registry/context.rs | 7 + crates/alknet-call/src/registry/discovery.rs | 6 + crates/alknet-call/src/registry/env.rs | 8 + crates/alknet-call/src/registry/mod.rs | 12 + .../alknet-call/src/registry/registration.rs | 8 + crates/alknet-call/src/registry/spec.rs | 7 + 16 files changed, 536 insertions(+), 28 deletions(-) create mode 100644 crates/alknet-call/Cargo.toml create mode 100644 crates/alknet-call/src/lib.rs create mode 100644 crates/alknet-call/src/protocol/abort.rs create mode 100644 crates/alknet-call/src/protocol/adapter.rs create mode 100644 crates/alknet-call/src/protocol/connection.rs create mode 100644 crates/alknet-call/src/protocol/mod.rs create mode 100644 crates/alknet-call/src/protocol/pending.rs create mode 100644 crates/alknet-call/src/protocol/wire.rs create mode 100644 crates/alknet-call/src/registry/context.rs create mode 100644 crates/alknet-call/src/registry/discovery.rs create mode 100644 crates/alknet-call/src/registry/env.rs create mode 100644 crates/alknet-call/src/registry/mod.rs create mode 100644 crates/alknet-call/src/registry/registration.rs create mode 100644 crates/alknet-call/src/registry/spec.rs diff --git a/Cargo.lock b/Cargo.lock index 4514e20..813fcad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] @@ -47,6 +47,22 @@ dependencies = [ "memchr", ] +[[package]] +name = "alknet-call" +version = "0.1.0" +dependencies = [ + "alknet-core", + "async-trait", + "futures", + "irpc", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tracing", + "uuid", +] + [[package]] name = "alknet-core" version = "0.1.0" @@ -129,7 +145,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5493c3bedbacf7fd7382c6346bbd66687d12bbaad3a89a2d2c303ee6cf20b048" dependencies = [ - "asn1-rs-derive", + "asn1-rs-derive 0.5.1", "asn1-rs-impl", "displaydoc", "nom", @@ -139,6 +155,22 @@ dependencies = [ "time", ] +[[package]] +name = "asn1-rs" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8" +dependencies = [ + "asn1-rs-derive 0.6.0", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror 2.0.18", + "time", +] + [[package]] name = "asn1-rs-derive" version = "0.5.1" @@ -151,6 +183,18 @@ dependencies = [ "synstructure", ] +[[package]] +name = "asn1-rs-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "asn1-rs-impl" version = "0.2.0" @@ -291,6 +335,15 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +dependencies = [ + "serde", +] + [[package]] name = "bitcoin_hashes" version = "0.14.2" @@ -383,7 +436,18 @@ checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", "cipher", - "cpufeatures", + "cpufeatures 0.2.17", +] + +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", ] [[package]] @@ -452,6 +516,15 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "cordyceps" version = "0.3.4" @@ -497,6 +570,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc" version = "3.4.0" @@ -560,7 +642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16182b4f39a82ec8a6851155cc4c0cda3065bb1db33651726a29e1951de0f009" dependencies = [ "aead", - "chacha20", + "chacha20 0.9.1", "crypto_secretbox", "curve25519-dalek", "salsa20", @@ -576,7 +658,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d6cf87adf719ddf43a805e92c6870a531aedda35ff640442cbaf8674e141e1" dependencies = [ "aead", - "chacha20", + "chacha20 0.9.1", "cipher", "generic-array", "poly1305", @@ -607,7 +689,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "curve25519-dalek-derive", "digest", "fiat-crypto", @@ -653,7 +735,21 @@ version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" dependencies = [ - "asn1-rs", + "asn1-rs 0.6.2", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "der-parser" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6" +dependencies = [ + "asn1-rs 0.7.2", "displaydoc", "nom", "num-bigint", @@ -684,7 +780,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ - "derive_more-impl", + "derive_more-impl 1.0.0", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl 2.1.1", ] [[package]] @@ -699,6 +804,20 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn", + "unicode-xid", +] + [[package]] name = "diatomic-waker" version = "0.2.3" @@ -818,6 +937,17 @@ dependencies = [ "syn", ] +[[package]] +name = "enum-assoc" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed8956bd5c1f0415200516e78ff07ec9e16415ade83c056c230d7b7ea0d55b7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "enumflags2" version = "0.7.12" @@ -1091,8 +1221,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", ] [[package]] @@ -1469,6 +1602,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "identity-hash" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfdd7caa900436d8f13b2346fe10257e0c05c1f1f9e351f4f5d57c03bd5f45da" + [[package]] name = "idna" version = "1.1.0" @@ -1577,7 +1716,7 @@ dependencies = [ "crypto_box", "data-encoding", "der", - "derive_more", + "derive_more 1.0.0", "ed25519-dalek", "futures-buffered", "futures-util", @@ -1592,14 +1731,14 @@ dependencies = [ "iroh-quinn-proto", "iroh-quinn-udp", "iroh-relay", - "n0-future", + "n0-future 0.1.3", "netdev", "netwatch", "pin-project", "pkarr", "portmapper", "rand 0.8.6", - "rcgen", + "rcgen 0.13.2", "reqwest", "ring", "rustls", @@ -1619,7 +1758,7 @@ dependencies = [ "url", "wasm-bindgen-futures", "webpki-roots 0.26.11", - "x509-parser", + "x509-parser 0.16.0", "z32", ] @@ -1631,7 +1770,7 @@ checksum = "f91ac4aaab68153d726c4e6b39c30f9f9253743f0e25664e52f4caeb46f48d11" dependencies = [ "curve25519-dalek", "data-encoding", - "derive_more", + "derive_more 1.0.0", "ed25519-dalek", "rand_core 0.6.4", "serde", @@ -1728,7 +1867,7 @@ dependencies = [ "bytes", "cfg_aliases", "data-encoding", - "derive_more", + "derive_more 1.0.0", "getrandom 0.3.4", "hickory-resolver", "http", @@ -1740,7 +1879,7 @@ dependencies = [ "iroh-quinn", "iroh-quinn-proto", "lru 0.12.5", - "n0-future", + "n0-future 0.1.3", "num_enum", "pin-project", "pkarr", @@ -1765,6 +1904,39 @@ dependencies = [ "z32", ] +[[package]] +name = "irpc" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a05799eb70acd04843c327ef939233ccf80f607d30e9ca94857ac7f3d8f18b46" +dependencies = [ + "futures-buffered", + "futures-util", + "irpc-derive", + "n0-error", + "n0-future 0.3.2", + "noq", + "postcard", + "rcgen 0.14.8", + "rustls", + "serde", + "smallvec", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "irpc-derive" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445d81dbc1eed4dab6379bf7f97d12ac28ce8e6f3f7d6660c9f333b7b5d8d03b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "itoa" version = "1.0.18" @@ -1970,6 +2142,27 @@ dependencies = [ "uuid", ] +[[package]] +name = "n0-error" +version = "1.0.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "223e946a84aa91644507a6b7865cfebbb9a231ace499041c747ab0fd30408212" +dependencies = [ + "n0-error-macros", + "spez", +] + +[[package]] +name = "n0-error-macros" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2acd8b070213b0299282f884b4beba4e7b52d624fdcd504a3ad3665390c11e1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "n0-future" version = "0.1.3" @@ -1977,7 +2170,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bb0e5d99e681ab3c938842b96fcb41bf8a7bb4bfdb11ccbd653a7e83e06c794" dependencies = [ "cfg_aliases", - "derive_more", + "derive_more 1.0.0", + "futures-buffered", + "futures-lite", + "futures-util", + "js-sys", + "pin-project", + "send_wrapper", + "tokio", + "tokio-util", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-time", +] + +[[package]] +name = "n0-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2ab99dfb861450e68853d34ae665243a88b8c493d01ba957321a1e9b2312bbe" +dependencies = [ + "cfg_aliases", + "derive_more 2.1.1", "futures-buffered", "futures-lite", "futures-util", @@ -2108,11 +2322,11 @@ dependencies = [ "atomic-waker", "bytes", "cfg_aliases", - "derive_more", + "derive_more 1.0.0", "iroh-quinn-udp", "js-sys", "libc", - "n0-future", + "n0-future 0.1.3", "nested_enum_utils", "netdev", "netlink-packet-core", @@ -2148,6 +2362,68 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "noq" +version = "1.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198b99fc085a5db1f7d259edb5ede8311e59f28cdd2687920b4313613d21a73f" +dependencies = [ + "bytes", + "cfg_aliases", + "derive_more 2.1.1", + "noq-proto", + "noq-udp", + "pin-project-lite", + "rustc-hash", + "rustls", + "socket2 0.6.4", + "thiserror 2.0.18", + "tokio", + "tokio-stream", + "tracing", + "web-time", +] + +[[package]] +name = "noq-proto" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775be06b8d66c2c64db60140bf54dee8410f67b73c81cc1e1e32f11dfdaae501" +dependencies = [ + "aes-gcm", + "bytes", + "derive_more 2.1.1", + "enum-assoc", + "getrandom 0.4.3", + "identity-hash", + "lru-slab", + "rand 0.10.1", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "sorted-index-buffer", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "noq-udp" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd5a37756f168cf350d68a97c4f0158bdf3c76f10175123941569b09ab51f011" +dependencies = [ + "cfg_aliases", + "libc", + "socket2 0.6.4", + "tracing", + "windows-sys 0.61.2", +] + [[package]] name = "ntimestamp" version = "1.0.0" @@ -2234,7 +2510,16 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d8034d9489cdaf79228eb9f6a3b8d7bb32ba00d6645ebd48eef4077ceb5bd9" dependencies = [ - "asn1-rs", + "asn1-rs 0.6.2", +] + +[[package]] +name = "oid-registry" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7" +dependencies = [ + "asn1-rs 0.7.2", ] [[package]] @@ -2487,7 +2772,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ - "cpufeatures", + "cpufeatures 0.2.17", "opaque-debug", "universal-hash", ] @@ -2499,7 +2784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "opaque-debug", "universal-hash", ] @@ -2518,7 +2803,7 @@ checksum = "7d6db66007eac4a0ec8331d0d20c734bd64f6445d64bbaf0d0a27fea7a054e36" dependencies = [ "base64", "bytes", - "derive_more", + "derive_more 1.0.0", "futures-lite", "futures-util", "hyper-util", @@ -2750,6 +3035,17 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +dependencies = [ + "chacha20 0.10.0", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -2788,6 +3084,21 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + [[package]] name = "rcgen" version = "0.13.2" @@ -2798,7 +3109,21 @@ dependencies = [ "ring", "rustls-pki-types", "time", - "yasna", + "yasna 0.5.2", +] + +[[package]] +name = "rcgen" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57f6d249aad744e274e682777a50283a225a32705394ee6d5fcc01efa25e4055" +dependencies = [ + "pem", + "ring", + "rustls-pki-types", + "time", + "x509-parser 0.18.1", + "yasna 0.6.0", ] [[package]] @@ -3209,7 +3534,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -3226,7 +3551,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -3338,6 +3663,23 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "sorted-index-buffer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea06cc588e43c632923a55450401b8f25e628131571d4e1baea1bdfdb2b5ed06" + +[[package]] +name = "spez" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87e960f4dca2788eeb86bbdde8dd246be8948790b7618d656e68f9b720a86e8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "spin" version = "0.10.0" @@ -3897,6 +4239,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + [[package]] name = "unicode-xid" version = "0.2.6" @@ -4576,17 +4924,35 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" dependencies = [ - "asn1-rs", + "asn1-rs 0.6.2", "data-encoding", - "der-parser", + "der-parser 9.0.0", "lazy_static", "nom", - "oid-registry", + "oid-registry 0.7.1", "rusticata-macros", "thiserror 1.0.69", "time", ] +[[package]] +name = "x509-parser" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202" +dependencies = [ + "asn1-rs 0.7.2", + "data-encoding", + "der-parser 10.0.0", + "lazy_static", + "nom", + "oid-registry 0.8.1", + "ring", + "rusticata-macros", + "thiserror 2.0.18", + "time", +] + [[package]] name = "xml-rs" version = "0.8.28" @@ -4611,6 +4977,16 @@ dependencies = [ "time", ] +[[package]] +name = "yasna" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5f6765e852b9b4dc8e2a76843e4d64d1cea8e79bcde0b6901aea8e7c7f08282" +dependencies = [ + "bit-vec", + "time", +] + [[package]] name = "yoke" version = "0.8.3" diff --git a/Cargo.toml b/Cargo.toml index fa8bbae..54debac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "crates/alknet-vault", "crates/alknet-core", + "crates/alknet-call", ] resolver = "2" diff --git a/crates/alknet-call/Cargo.toml b/crates/alknet-call/Cargo.toml new file mode 100644 index 0000000..a9adfd6 --- /dev/null +++ b/crates/alknet-call/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "alknet-call" +version.workspace = true +edition.workspace = true +license.workspace = true +description = "Structured RPC over QUIC on ALPN `alknet/call`: operations, streaming subscriptions, service discovery" +repository.workspace = true + +[lib] +name = "alknet_call" + +[features] +default = [] + +[dependencies] +alknet-core = { path = "../alknet-core" } +irpc = { workspace = true } +tokio = { version = "1", features = ["full"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +async-trait = "0.1" +tracing = "0.1" +thiserror = "2" +uuid = { version = "1", features = ["v4"] } +futures = "0.3" \ No newline at end of file diff --git a/crates/alknet-call/src/lib.rs b/crates/alknet-call/src/lib.rs new file mode 100644 index 0000000..c6a8190 --- /dev/null +++ b/crates/alknet-call/src/lib.rs @@ -0,0 +1,10 @@ +//! alknet-call: Structured RPC over QUIC — operations, streaming, service discovery. +//! +//! Implements [`alknet_core::types::ProtocolHandler`] on ALPN `alknet/call`. +//! +//! The crate has two subsystems: +//! - [`registry`] — operation specs, context, dispatch, and the operation registry. +//! - [`protocol`] — wire format, streams, and the call adapter. + +pub mod protocol; +pub mod registry; diff --git a/crates/alknet-call/src/protocol/abort.rs b/crates/alknet-call/src/protocol/abort.rs new file mode 100644 index 0000000..9b7ac62 --- /dev/null +++ b/crates/alknet-call/src/protocol/abort.rs @@ -0,0 +1,7 @@ +//! Abort cascade logic for nested calls (ADR-016). +//! +//! When `call.aborted` arrives for a parent request, the protocol cascades +//! the abort to all non-terminal descendants in the call tree. Default +//! policy is `abort-dependents`; `continue-running` is an opt-in. + +// TODO: implement diff --git a/crates/alknet-call/src/protocol/adapter.rs b/crates/alknet-call/src/protocol/adapter.rs new file mode 100644 index 0000000..506ba5f --- /dev/null +++ b/crates/alknet-call/src/protocol/adapter.rs @@ -0,0 +1,8 @@ +//! `CallAdapter`: implements `ProtocolHandler` for ALPN `alknet/call`. +//! +//! Accepts bidirectional streams, reads `EventEnvelope` frames, and +//! dispatches `call.requested` events to the operation registry. See +//! `docs/architecture/crates/call/call-protocol.md` for the full +//! specification. + +// TODO: implement diff --git a/crates/alknet-call/src/protocol/connection.rs b/crates/alknet-call/src/protocol/connection.rs new file mode 100644 index 0000000..e7b3b07 --- /dev/null +++ b/crates/alknet-call/src/protocol/connection.rs @@ -0,0 +1,8 @@ +//! `CallConnection`: an established `alknet/call` connection (either +//! direction — accepted or opened). Holds the connection's Layer 2 overlay +//! (imported ops). +//! +//! See `docs/architecture/crates/call/call-protocol.md` for the full +//! specification. + +// TODO: implement diff --git a/crates/alknet-call/src/protocol/mod.rs b/crates/alknet-call/src/protocol/mod.rs new file mode 100644 index 0000000..a8dc2e2 --- /dev/null +++ b/crates/alknet-call/src/protocol/mod.rs @@ -0,0 +1,11 @@ +//! Call protocol: wire format, streams, and the call adapter. +//! +//! Implements `ProtocolHandler` for ALPN `alknet/call` on top of the +//! operation registry. See `docs/architecture/crates/call/call-protocol.md` +//! for the full specification. + +pub mod abort; +pub mod adapter; +pub mod connection; +pub mod pending; +pub mod wire; diff --git a/crates/alknet-call/src/protocol/pending.rs b/crates/alknet-call/src/protocol/pending.rs new file mode 100644 index 0000000..c6e50c7 --- /dev/null +++ b/crates/alknet-call/src/protocol/pending.rs @@ -0,0 +1,7 @@ +//! Pending request tracking: `PendingRequestMap` and `PendingEntry`. +//! +//! Correlates `call.responded` events back to the original `call.requested` +//! by request ID. See `docs/architecture/crates/call/call-protocol.md` for +//! the full specification. + +// TODO: implement diff --git a/crates/alknet-call/src/protocol/wire.rs b/crates/alknet-call/src/protocol/wire.rs new file mode 100644 index 0000000..6c62352 --- /dev/null +++ b/crates/alknet-call/src/protocol/wire.rs @@ -0,0 +1,7 @@ +//! Wire format: `EventEnvelope`, `ResponseEnvelope`, `CallError`, and +//! length-prefixed JSON framing. +//! +//! See `docs/architecture/crates/call/call-protocol.md` for the full +//! specification. + +// TODO: implement diff --git a/crates/alknet-call/src/registry/context.rs b/crates/alknet-call/src/registry/context.rs new file mode 100644 index 0000000..a3ccb75 --- /dev/null +++ b/crates/alknet-call/src/registry/context.rs @@ -0,0 +1,7 @@ +//! Operation context: `OperationContext`, `AbortPolicy`, +//! `CompositionAuthority`, and `ScopedOperationEnv`. +//! +//! See `docs/architecture/crates/call/operation-registry.md` for the full +//! specification. + +// TODO: implement diff --git a/crates/alknet-call/src/registry/discovery.rs b/crates/alknet-call/src/registry/discovery.rs new file mode 100644 index 0000000..ef16fb1 --- /dev/null +++ b/crates/alknet-call/src/registry/discovery.rs @@ -0,0 +1,6 @@ +//! Service discovery handlers: `services/list` and `services/schema`. +//! +//! See `docs/architecture/crates/call/operation-registry.md` for the full +//! specification. + +// TODO: implement diff --git a/crates/alknet-call/src/registry/env.rs b/crates/alknet-call/src/registry/env.rs new file mode 100644 index 0000000..20cb725 --- /dev/null +++ b/crates/alknet-call/src/registry/env.rs @@ -0,0 +1,8 @@ +//! Operation environment: the `OperationEnv` trait, `LocalOperationEnv`, and +//! `CompositeOperationEnv`. +//! +//! The composition dispatch trait — handlers compose child operations through +//! `OperationContext.env`. See +//! `docs/architecture/crates/call/operation-registry.md` and ADR-024. + +// TODO: implement diff --git a/crates/alknet-call/src/registry/mod.rs b/crates/alknet-call/src/registry/mod.rs new file mode 100644 index 0000000..9a1ee80 --- /dev/null +++ b/crates/alknet-call/src/registry/mod.rs @@ -0,0 +1,12 @@ +//! Operation registry: specs, handlers, access control, service discovery. +//! +//! Maps operation names to specs and handlers, enforces access control, and +//! dispatches `call.requested` events to local handlers. The registry is +//! layered by trust boundary (ADR-024): a curated layer (immutable after +//! startup) plus dynamic session and connection overlays. + +pub mod context; +pub mod discovery; +pub mod env; +pub mod registration; +pub mod spec; diff --git a/crates/alknet-call/src/registry/registration.rs b/crates/alknet-call/src/registry/registration.rs new file mode 100644 index 0000000..c7cc84d --- /dev/null +++ b/crates/alknet-call/src/registry/registration.rs @@ -0,0 +1,8 @@ +//! Handler registration: `Handler`, `HandlerRegistration`, +//! `OperationProvenance`, `OperationRegistry`, and +//! `OperationRegistryBuilder`. +//! +//! See `docs/architecture/crates/call/operation-registry.md` for the full +//! specification. + +// TODO: implement diff --git a/crates/alknet-call/src/registry/spec.rs b/crates/alknet-call/src/registry/spec.rs new file mode 100644 index 0000000..81b6f09 --- /dev/null +++ b/crates/alknet-call/src/registry/spec.rs @@ -0,0 +1,7 @@ +//! Operation specifications: `OperationSpec`, `OperationType`, `Visibility`, +//! `ErrorDefinition`, and `AccessControl`. +//! +//! See `docs/architecture/crates/call/operation-registry.md` for the full +//! specification. + +// TODO: implement