Skip to main content
Version: Current

SubscribeResult

@rotorsoft/act-root


@rotorsoft/act-root / act/src / SubscribeResult

Type Alias: SubscribeResult

SubscribeResult = object

Defined in: libs/act/src/types/ports.ts:73

Result of a Store.subscribe call.

Named rather than written inline because three places state it โ€” the port, the drain's helper, and every adapter โ€” and they drifted apart the moment one of them grew a field.

Propertiesโ€‹

correlated_atโ€‹

correlated_at: number

Defined in: libs/act/src/types/ports.ts:114

The correlate checkpoint (#1484): how far correlate has read the event log, or -1 when it has never advanced.

Distinct from a subscription's at (how far a target has been processed) โ€” a run of events resolving to no target moves this and no watermark. It rides subscribe's existing return and is advanced by the same call's correlated_at argument, so maintaining it costs no store round trip of its own: correlate already calls subscribe with the targets each scan discovered.

Adapters keep it in their own relation, never as a subscription, so no stream-scoped surface (prioritize, reset, unblock, query_streams, blocked_streams) ever counts it.

Keyed per correlator when a correlator is supplied (#1532), and shared otherwise. Correlators that look for different things read the log for different reasons, so one inheriting another's position at cold start could skip events it needed โ€” previously survivable only because of the back-scan window. A key with no row yet falls back to the shared value, so an upgrade does not re-read history.


correlating?โ€‹

optional correlating?: boolean

Defined in: libs/act/src/types/ports.ts:91

Whether the caller holds the correlation lease and should scan (#1532).

undefined when no correlator was supplied โ€” no lease was requested, so there is no answer and the caller scans as it always has.

Acquiring MUST be atomic. A read-then-write lets two workers both see an expired lease and both believe they hold it, which is precisely the duplication the lease removes.

Released by expiry only: a crash and a clean stop then take the same path, so the recovery path is the common one. A holder can still hand it back early by renewing with a minimal millis.


subscribedโ€‹

subscribed: number

Defined in: libs/act/src/types/ports.ts:74


watermarkโ€‹

watermark: number

Defined in: libs/act/src/types/ports.ts:75