api

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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 New

func New(st *ledger.Store) *Facade

New 组装点调用。

func (*Facade) BindDriver

func (f *Facade) BindDriver(id, session, carrier, expect string) error

func (*Facade) Delete

func (f *Facade) Delete(kind, id string, expectVersion int, actor string) error

Delete 以 CAS 语义删除一条注册表实体(透传)。expectVersion 必须等于当前 版本;删除前先 Get 取版本。

func (*Facade) DriverLease

func (f *Facade) DriverLease(session string) (time.Time, bool, error)

func (*Facade) EffectiveBaseBranch

func (f *Facade) EffectiveBaseBranch(id string) (string, error)

EffectiveBaseBranch 读卡的有效基线分支(透传 Store.EffectiveBaseBranch, internal/ledger/relations.go)。开场评估与重建四步的新鲜度判据。

func (*Facade) EventsFromAsc

func (f *Facade) EventsFromAsc(cardIDs []string, fromSeq int64, limit int) ([]proto.LedgerEvent, error)

func (*Facade) Get

func (f *Facade) Get(kind, id string) (RegistryEntry, error)

Get 读一条注册表实体(透传;不存在返回 ledger.ErrNotFound 包装错误)。

func (*Facade) GetCard

func (f *Facade) GetCard(id string) (proto.Card, error)

func (*Facade) List

func (f *Facade) List(kind string) ([]RegistryEntry, error)

List 按 kind 列出全部实体,seq 升序(透传)。

func (*Facade) ListActiveCards

func (f *Facade) ListActiveCards(project string) ([]proto.Card, error)

func (*Facade) ListAllCards

func (f *Facade) ListAllCards(project string) ([]proto.Card, error)

ListAllCards 是 ListCards{IncludeTerminal:true} 的直通镜像(B156.2 岔口一 方案甲还债直通):终态房间「沉底可列」与并入只读判定的唯一枚举源。 Following 投影随 CardView 直通,本方法不做任何业务判断。

func (*Facade) MarkNeedsHuman

func (f *Facade) MarkNeedsHuman(cardID, reason, actor string) error

MarkNeedsHuman 打等人标记(透传 Store.MarkNeedsHuman, internal/ledger/events.go)。唤醒兜底链终点「转等人」经此落账。

func (*Facade) Put

func (f *Facade) Put(kind, id string, expectVersion int, body []byte, actor string) (int, error)

Put 以 CAS 语义写入注册表实体,返回新版本号(透传 Store.RegistryPut)。 expectVersion 必须等于当前版本;0 表示必须不存在(新建)。

func (*Facade) RecordMessageConsumed

func (f *Facade) RecordMessageConsumed(cardID string, msgSeq int64, consumer string) error

func (*Facade) RecordRoomMessage

func (f *Facade) RecordRoomMessage(cardID string, msg proto.RoomMessage, actor string) (int64, error)

type RegistryEntry

type RegistryEntry struct {
	Kind    string
	ID      string
	Version int
	Seq     int64
	Body    json.RawMessage
}

RegistryEntry 是注册表一行(载体/小队/点火队列等版本化实体)的门面 DTO。 字段与 ledger.RegistryEntry 一一对应:Seq 是全表单调写入序,Body 是写入方 序列化好的 JSON——账本不解释其内容。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL