Documentation
¶
Overview ¶
Package api 是账本域对协作房间域的薄门面(B156.2 还债路径):包住既有 *ledger.Store,逐方法转调并做 Event→proto.LedgerEvent 映射(先例 ledgerEventWire,internal/agentd/ledgerapi.go:106),不含任何业务判断。 由组装点构造并注入 collab.New;组装点之外只认 client.LedgerClient 接口, 不要直接引用本包的具体类型。
本文件属直通镜像接线:转调体照抄既有同形方法的接线形态。
keystone 半段(B156.3 门面归一轮补入):keystone 域经 keysclient.LedgerView 端口消费的两条账本能力。逐方法转调既有 Store 实现,不含任何业务判断—— 唤醒决策与兜底链的规则归 d_keystone(B156.3 spec §7.1)。
跨卡约束:本文件与 registry.go 是与 B156.2 商定的新增落点,api.go 一个 字符不动;两份门面已归一,internal/ledgerapi 不复存在。
注册表半段(B156.3 门面归一轮补入):编制域经 schedclient.Registry 端口 消费的四个版本化 KV 原语。逐方法转调 internal/ledger/registry.go 的既有 Store 实现 + RegistryEntry→本包 DTO 映射,不含任何业务判断——载体/小队的 规则归 d_scheduling(B156.3 spec §7.1)。
跨卡约束:本文件与 keystone.go 是与 B156.2 商定的新增落点,api.go 一个 字符不动;两份门面已归一,internal/ledgerapi 不复存在。
Index ¶
- type Facade
- func (f *Facade) AddSessionMember(sessionID, identity, actor string) error
- func (f *Facade) ArchiveSession(id, actor string) error
- func (f *Facade) BindDriver(id, session, carrier, expect string) error
- func (f *Facade) CardRoomUserMessagesContext(ctx context.Context, cardIDs []string, afterSeq int64, limit int) ([]proto.LedgerEvent, error)
- func (f *Facade) ConsumedMessageSeqsContext(ctx context.Context, consumer string, afterSeq int64) ([]int64, error)
- func (f *Facade) CreateSession(title, owner, actor string) (proto.Session, error)
- func (f *Facade) Delete(kind, id string, expectVersion int, actor string) error
- func (f *Facade) DriverLease(session string) (time.Time, bool, error)
- func (f *Facade) EffectiveBaseBranch(id string) (string, error)
- func (f *Facade) EventBySeq(seq int64) (proto.LedgerEvent, bool, error)
- func (f *Facade) EventsFromAsc(cardIDs []string, fromSeq int64, limit int) ([]proto.LedgerEvent, error)
- func (f *Facade) EventsFromAscContext(ctx context.Context, cardIDs []string, fromSeq int64, limit int) ([]proto.LedgerEvent, error)
- func (f *Facade) Get(kind, id string) (RegistryEntry, error)
- func (f *Facade) GetCard(id string) (proto.Card, error)
- func (f *Facade) GetSession(id string) (proto.Session, error)
- func (f *Facade) JoinCardToSession(sessionID, cardID, actor string) error
- func (f *Facade) LatestNeedsEventsContext(ctx context.Context, cardIDs []string) ([]proto.LedgerEvent, error)
- func (f *Facade) LeaveCardToSession(sessionID, cardID, actor string) error
- func (f *Facade) List(kind string) ([]RegistryEntry, error)
- func (f *Facade) ListActiveCards(project string) ([]proto.Card, error)
- func (f *Facade) ListAllCards(project string) ([]proto.Card, error)
- func (f *Facade) ListSessions() ([]proto.Session, error)
- func (f *Facade) MarkNeedsHuman(cardID, reason, actor string) error
- func (f *Facade) MentionCandidatesContext(ctx context.Context, member, roomID string, cardlessOnly bool, afterSeq int64, ...) ([]proto.LedgerEvent, error)
- func (f *Facade) Put(kind, id string, expectVersion int, body []byte, actor string) (int, error)
- func (f *Facade) RecordMessageConsumed(cardID string, msgSeq int64, consumer string) error
- func (f *Facade) RecordRoomMessage(cardID string, msg proto.RoomMessage, actor string) (int64, error)
- func (f *Facade) RoomMessageSnapshotsContext(ctx context.Context, afterByRoom map[string]int64) ([]client.RoomMessageSnapshot, error)
- func (f *Facade) RoomMessagesBeforeContext(ctx context.Context, roomID string, beforeSeq int64, limit int) ([]proto.LedgerEvent, error)
- func (f *Facade) SessionOfCard(cardID string) (string, error)
- func (f *Facade) SessionProjectionEventsContext(ctx context.Context, sessionID string, cardIDs []string) ([]proto.LedgerEvent, error)
- type RegistryEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Facade ¶
type Facade struct {
// contains filtered or unexported fields
}
Facade 实现 client.LedgerClient;组装点之外请只认接口。
func (*Facade) AddSessionMember ¶ added in v0.5.0
AddSessionMember 把一个显式成员记入会话(幂等)。
func (*Facade) ArchiveSession ¶ added in v0.5.0
func (*Facade) BindDriver ¶
func (*Facade) CardRoomUserMessagesContext ¶ added in v0.5.0
func (f *Facade) CardRoomUserMessagesContext(ctx context.Context, cardIDs []string, afterSeq int64, limit int) ([]proto.LedgerEvent, error)
CardRoomUserMessagesContext 直通账本绑定卡用户消息读。
func (*Facade) ConsumedMessageSeqsContext ¶ added in v0.5.0
func (f *Facade) ConsumedMessageSeqsContext(ctx context.Context, consumer string, afterSeq int64) ([]int64, error)
ConsumedMessageSeqsContext 直通账本消费标记批量读。
func (*Facade) CreateSession ¶ added in v0.5.0
func (*Facade) EffectiveBaseBranch ¶
EffectiveBaseBranch 读卡的有效基线分支(透传 Store.EffectiveBaseBranch, internal/ledger/relations.go)。开场评估与重建四步的新鲜度判据。
func (*Facade) EventBySeq ¶ added in v0.5.0
EventBySeq 直通账本 seq 点读。
func (*Facade) EventsFromAsc ¶
func (*Facade) EventsFromAscContext ¶ added in v0.5.0
func (*Facade) Get ¶
func (f *Facade) Get(kind, id string) (RegistryEntry, error)
Get 读一条注册表实体(透传;不存在返回 ledger.ErrNotFound 包装错误)。
func (*Facade) GetSession ¶ added in v0.5.0
func (*Facade) JoinCardToSession ¶ added in v0.5.0
func (*Facade) LatestNeedsEventsContext ¶ added in v0.5.0
func (f *Facade) LatestNeedsEventsContext(ctx context.Context, cardIDs []string) ([]proto.LedgerEvent, error)
LatestNeedsEventsContext 直通各卡最新 needs 状态事件。
func (*Facade) LeaveCardToSession ¶ added in v0.5.0
func (*Facade) List ¶
func (f *Facade) List(kind string) ([]RegistryEntry, error)
List 按 kind 列出全部实体,seq 升序(透传)。
func (*Facade) ListActiveCards ¶
func (*Facade) ListAllCards ¶
ListAllCards 是 ListCards{IncludeTerminal:true} 的直通镜像(B156.2 岔口一 方案甲还债直通):终态房间「沉底可列」与并入只读判定的唯一枚举源。 Following 投影随 CardView 直通,本方法不做任何业务判断。
func (*Facade) ListSessions ¶ added in v0.5.0
func (*Facade) MarkNeedsHuman ¶
MarkNeedsHuman 打等人标记(透传 Store.MarkNeedsHuman, internal/ledger/events.go)。唤醒兜底链终点「转等人」经此落账。
func (*Facade) MentionCandidatesContext ¶ added in v0.5.0
func (f *Facade) MentionCandidatesContext(ctx context.Context, member, roomID string, cardlessOnly bool, afterSeq int64, limit int) ([]proto.LedgerEvent, error)
MentionCandidatesContext 直通账本提及候选读。
func (*Facade) Put ¶
Put 以 CAS 语义写入注册表实体,返回新版本号(透传 Store.RegistryPut)。 expectVersion 必须等于当前版本;0 表示必须不存在(新建)。
func (*Facade) RecordMessageConsumed ¶
func (*Facade) RecordRoomMessage ¶
func (*Facade) RoomMessageSnapshotsContext ¶ added in v0.5.0
func (f *Facade) RoomMessageSnapshotsContext(ctx context.Context, afterByRoom map[string]int64) ([]client.RoomMessageSnapshot, error)
RoomMessageSnapshotsContext 直通账本批量房间消息摘要,并映射最新事件 wire。
func (*Facade) RoomMessagesBeforeContext ¶ added in v0.5.0
func (f *Facade) RoomMessagesBeforeContext(ctx context.Context, roomID string, beforeSeq int64, limit int) ([]proto.LedgerEvent, error)
RoomMessagesBeforeContext 直通账本房间历史查询并投影 wire 事件。
func (*Facade) SessionOfCard ¶ added in v0.5.0
func (*Facade) SessionProjectionEventsContext ¶ added in v0.5.0
func (f *Facade) SessionProjectionEventsContext(ctx context.Context, sessionID string, cardIDs []string) ([]proto.LedgerEvent, error)
SessionProjectionEventsContext 直通单会话详情事件范围,不在 facade 解释业务。
type RegistryEntry ¶
RegistryEntry 是注册表一行(载体/小队/点火队列等版本化实体)的门面 DTO。 字段与 ledger.RegistryEntry 一一对应:Seq 是全表单调写入序,Body 是写入方 序列化好的 JSON——账本不解释其内容。