DOC-FULL-002:ReadingSession V2 #103

Open
opened 2026-06-10 21:18:32 +08:00 by wangdl · 0 comments
Owner

目标

实现 V2 阅读会话模型。一次打开资料到关闭资料为一个 ReadingSession。

字段建议

  • clientSessionId
  • materialId
  • openedAtMs
  • closedAtMs?
  • lastEventAtMs
  • lastPosition?
  • sequence
  • status

status

  • active
  • closed
  • interrupted
  • failed

规则

  1. clientSessionId 由 Rust 生成。
  2. 每个 session 内 sequence 单调递增。
  3. ReadingSession 不保存 readingTargetType。
  4. ReadingSession 不保存 userId。
  5. MaterialOpened 创建 session。
  6. MaterialClosed 关闭 session。
  7. interrupted 用于异常中断或未正常 close 场景。

需要提供的方法

openSession(materialRef, timestampMs)
closeSession(clientSessionId, position?, timestampMs)
getActiveSession(materialId)
markSessionInterrupted(clientSessionId)

验收标准

  1. openSession 可生成 clientSessionId。
  2. closeSession 可关闭 active session。
  3. sequence 在同一 session 内递增。
  4. Session 不包含业务字段。
  5. 异常中断可标记 interrupted。
  6. 有单元测试。
  7. 可通过 FFI 暴露必要接口。
## 目标 实现 V2 阅读会话模型。一次打开资料到关闭资料为一个 ReadingSession。 ## 字段建议 - clientSessionId - materialId - openedAtMs - closedAtMs? - lastEventAtMs - lastPosition? - sequence - status ## status - active - closed - interrupted - failed ## 规则 1. clientSessionId 由 Rust 生成。 2. 每个 session 内 sequence 单调递增。 3. ReadingSession 不保存 readingTargetType。 4. ReadingSession 不保存 userId。 5. MaterialOpened 创建 session。 6. MaterialClosed 关闭 session。 7. interrupted 用于异常中断或未正常 close 场景。 ## 需要提供的方法 ``` openSession(materialRef, timestampMs) closeSession(clientSessionId, position?, timestampMs) getActiveSession(materialId) markSessionInterrupted(clientSessionId) ``` ## 验收标准 1. openSession 可生成 clientSessionId。 2. closeSession 可关闭 active session。 3. sequence 在同一 session 内递增。 4. Session 不包含业务字段。 5. 异常中断可标记 interrupted。 6. 有单元测试。 7. 可通过 FFI 暴露必要接口。
wangdl added this to the M-DOC-FULL:Document Runtime 完整阅读内核与学习事件协议 milestone 2026-06-10 21:18:32 +08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wangdl/zhixi-document-runtime#103
No description provided.