Repository navigation
feat(kotlin): 插件 API、统一事件、测试工具与运行时契约(#390) - #498
Merged
Merged
Conversation
Kotlin SDK K-P1 的第二部分:
- 插件 API 3:Rutis.define<C>(name, inject, provides?, schema?) { ctx, config -> };
配置是 @serializable 类型,经 RutisFormat 解码,schema 由 SerialDescriptor 推出
(可覆盖);service<T>(sync = …) 声明方法种类(默认 async);Ctx 是行的协程
作用域(卸载时取消并等待),use<I>(@RutisClient 代理;同进程提供者实现 I 时
得到对象本身)、provide(没声明的服务以 rows.announce 通告,方法全为 async;
宿主比 0.12 旧时按契约提示一次)、effect(卸载时逆序)。
- 运行时:mount(features rows.v2、hosts、leaf、scopes、rows.announce;
plugins、implementation、engine)、rows.schema / load / update / unload、
hosts.provide / withdraw、release、get、dispose;调用方的行(每行按 isolate
计算自己的服务 id);插件 API 版本检查。
- 统一事件:on(prepend、global,监听器一律 kind sync)、emit / parallel / serial /
waterfall / bail / filter;快速路径与经宿主的 events.dispatch(filter 为选择器
函数引用、terminal);events.on / off / elsewhere / call 在读线程上按帧序处理;
emit 按监听器串行;作用域;卸载时拒绝该行的 events.call、撤下服务、取消并
等待正在运行的监听器(RUTIS_SHUTDOWN_TIMEOUT);rutis/* 只可监听;
报告行原文;对没有 events-v2 的宿主握手后按原文拒绝。
- jvm 测试入口 Rutis.serve(args, plugins…)(unix: / 裸路径 / tcp: 加令牌):
会话结束卸载全部行,清理超过时限或旧宿主时以 1 退出。
- 测试工具 arcships.rutis.testing(RutisTest.load):内存通道上的真实会话,
测试一方是宿主(服务、总线、行与作用域)。
- rutis-conformance:weather 与 conformance-events 插件、Main(Rutis.serve);
测试工具对 weather.expected.json 与 events.expected.json 的检查(51 个用例)。
- 期望文件:weather 加 kotlin/* 样例值;events 的语言加 kotlin(Kotlin 监听器
是同步的,两个 async-listener 用例除外),toolCases 加 kotlin 51;
events.rs 记下 Kotlin 的取消(CancellationException)。
- Rust:session_matrix 加 Kotlin(回拨 socket 路径、loopback);loader 的测试
feature kotlin,events_conformance 以 Kotlin 为 X,并作其他语言的 Y。
- CI:runtimes-kotlin 加 session_matrix 与 events_conformance。
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.
Kotlin SDK K-P1 的第二部分(第一部分 #492 已合并),按设计 §三、§四与运行时契约。
内容
Rutis.define<C>(name, inject, provides?, schema?) { ctx, config -> };配置是@Serializable类型,经RutisFormat解码,schema 由SerialDescriptor推出(可覆盖);service<T>(sync = …)声明方法种类(默认async)。Ctx:行的协程作用域(卸载时取消并等待);use<I>(@RutisClient代理;同进程提供者实现I时得到对象本身;调用对端sync方法时帧带sync: true);provide(没声明的服务以rows.announce通告,方法全为async;宿主比 0.12 旧时按契约提示一次);effect。mount(featuresrows.v2、hosts、leaf、scopes、rows.announce;plugins、implementation、engine)、rows.schema/load/update/unload、hosts.provide/withdraw、release、get、dispose;调用方的行(每行按isolate计算自己的服务 id,标签不透明);插件 API 版本检查。on(prepend、global,监听器一律kind: "sync")、emit/parallel/serial/waterfall/bail/filter;快速路径与events.dispatch(选择器函数引用、terminal);events.on/off/elsewhere/call在读线程上按帧序处理;emit按监听器串行;作用域;卸载时拒绝该行的events.call、撤下服务、取消并等待正在运行的监听器(RUTIS_SHUTDOWN_TIMEOUT);rutis/*只可监听;报告行原文;对没有events-v2的宿主握手后按原文拒绝。Rutis.serve(args, plugins…)(unix:/ 裸路径 /tcp:加令牌):会话结束卸载全部行;旧宿主或清理超时以 1 退出。arcships.rutis.testing(RutisTest.load):内存通道上的真实会话,测试一方是宿主。rutis-conformance:weather 与 conformance-events 插件;测试工具对weather.expected.json、events.expected.json(51 个用例)的检查。kotlin/*样例值;events 的语言加kotlin(Kotlin 监听器是同步的,两个 async-listener 用例与 Go、Swift 一样除外),toolCases加kotlin: 51;events.rs记下 Kotlin 的取消(CancellationException)。session_matrix加 Kotlin(回拨 socket 路径、loopback);loader 的测试 featurekotlin,events_conformance以 Kotlin 为 X 并作其他语言的 Y。runtimes-kotlin加session_matrix与events_conformance。与设计的出入
验证(本机)
./gradlew build:单元测试 22 项(新增运行时测试 4 项),测试工具对 weather 期望全部条目、对 events 期望 51 个用例通过。session_matrixKotlin 2 项;events_conformance(node、python、kotlin 必需)写定放置 4 项全部通过,抽样放置下 Kotlin 作 X 全部用例通过;events_expected通过;clippy、fmt 干净。Refs #390