Skip to main content

Class: LifecycleSerial

Defined in: packages/agentos/src/io/channels/meetings/LifecycleSerial.ts:8

Orders asynchronous lifecycle operations and invalidates pending starts synchronously.

A start takes a LifecycleSerial.stamp before its first await and checks LifecycleSerial.allows before it publishes anything; a suspension or an end calls LifecycleSerial.invalidate at once, before it queues its own work, so a start still in flight can never publish after it. An end (invalidate(true)) is irreversible.

Constructors​

Constructor​

new LifecycleSerial(): LifecycleSerial

Returns​

LifecycleSerial

Accessors​

ended​

Get Signature​

get ended(): boolean

Defined in: packages/agentos/src/io/channels/meetings/LifecycleSerial.ts:18

Whether an end has invalidated the lifecycle for good.

Returns​

boolean

Methods​

allows()​

allows(stamp): boolean

Defined in: packages/agentos/src/io/channels/meetings/LifecycleSerial.ts:16

Whether work stamped with stamp may still act: nothing invalidated it since, and the lifecycle is not ending.

Parameters​

stamp​

number

Returns​

boolean


invalidate()​

invalidate(ending?): void

Defined in: packages/agentos/src/io/channels/meetings/LifecycleSerial.ts:21

Invalidates every stamp taken so far; with ending, every later stamp too, for good.

Parameters​

ending?​

boolean = false

Returns​

void


run()​

run<T>(work): Promise<T>

Defined in: packages/agentos/src/io/channels/meetings/LifecycleSerial.ts:27

Runs work after every operation queued before it, whether those resolved or rejected; answers its result.

Type Parameters​

T​

T

Parameters​

work​

() => Promise<T>

Returns​

Promise<T>


stamp()​

stamp(): number

Defined in: packages/agentos/src/io/channels/meetings/LifecycleSerial.ts:14

The current generation, for a start to check later with LifecycleSerial.allows.

Returns​

number