Skip to content

@codesoul-co/hypha-harness / durable-event-store-bridge

模块用法

用于创建、记录或读取 Event 契约。Durable event store bridge 模块公开 1 类、2 接口。

从包入口导入

ts
import {
  DurableEventStoreBridge,
} from '@codesoul-co/hypha-harness';

import type {
  DurableEventStoreBridgeCoordination,
  DurableEventStoreBridgeOptions,
} from '@codesoul-co/hypha-harness';

使用要点

  • 2 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 1 个类提供可实例化的运行时实现;构造参数与公开方法在各自条目中完整列出。

公共导出

Symbol种类签名说明
DurableEventStoreBridgenew DurableEventStoreBridge(options: DurableEventStoreBridgeOptions): DurableEventStoreBridgeAdapts the legacy append/list EventStore surface to canonical durable streams. It carries no Run state; every read is rebuilt from the durable Event Runtime.
DurableEventStoreBridgeCoordination接口interface DurableEventStoreBridgeCoordinationDurable Event Store Bridge Coordination 接口,共包含 5 个公开字段或方法。
DurableEventStoreBridgeOptions接口interface DurableEventStoreBridgeOptionsDurable Event Store Bridge Options 接口,共包含 4 个公开字段或方法。

DurableEventStoreBridge

Adapts the legacy append/list EventStore surface to canonical durable streams. It carries no Run state; every read is rebuilt from the durable Event Runtime.

声明

text
export declare class DurableEventStoreBridge implements EventStore, TraceRecorder {
    constructor(options: DurableEventStoreBridgeOptions);
    append(event: FrameworkEvent): Promise<void>;
    record(event: FrameworkEvent): Promise<void>;
    list(filter?: EventFilter): Promise<FrameworkEvent[]>;
}

公开成员

成员种类签名说明
append方法append(event: FrameworkEvent): Promise<void>公开方法;参数与返回类型以签名列为准。
constructor构造函数(options: DurableEventStoreBridgeOptions): DurableEventStoreBridge创建该类的实例。
list方法list(filter?: EventFilter): Promise<FrameworkEvent[]>公开方法;参数与返回类型以签名列为准。
record方法record(event: FrameworkEvent): Promise<void>公开方法;参数与返回类型以签名列为准。

DurableEventStoreBridgeCoordination

Durable Event Store Bridge Coordination 接口,共包含 5 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { DurableEventStoreBridgeCoordination } from '@codesoul-co/hypha-harness';
  • 源码模块: durable-event-store-bridge

声明

text
export interface DurableEventStoreBridgeCoordination {
    runLeases: RunLeaseStore;
    ownerId: string;
    leaseTtlMs: number;
    nextId(namespace: string): string;
    now?: () => string;
}

契约成员

成员种类签名说明
leaseTtlMs属性leaseTtlMs: number公开属性;类型、只读和可选状态以签名列为准。
nextId方法nextId(namespace: string): string公开方法;参数与返回类型以签名列为准。
now方法now?(): string公开方法;参数与返回类型以签名列为准。
ownerId属性ownerId: string公开属性;类型、只读和可选状态以签名列为准。
runLeases属性runLeases: RunLeaseStore公开属性;类型、只读和可选状态以签名列为准。

DurableEventStoreBridgeOptions

Durable Event Store Bridge Options 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { DurableEventStoreBridgeOptions } from '@codesoul-co/hypha-harness';
  • 源码模块: durable-event-store-bridge

声明

text
export interface DurableEventStoreBridgeOptions {
    events: EventRuntime;
    coordination?: DurableEventStoreBridgeCoordination;
    maxAppendAttempts?: number;
    streamHeadPageSize?: number;
}

契约成员

成员种类签名说明
coordination属性coordination?: DurableEventStoreBridgeCoordination公开属性;类型、只读和可选状态以签名列为准。
events属性events: EventRuntime公开属性;类型、只读和可选状态以签名列为准。
maxAppendAttempts属性maxAppendAttempts?: number公开属性;类型、只读和可选状态以签名列为准。
streamHeadPageSize属性streamHeadPageSize?: number公开属性;类型、只读和可选状态以签名列为准。