Skip to main content
Version: latest (master)

Class: OpControlSubscriber

Defined in: src/op-control.ts:165

Methods

close()

close(): void

Defined in: src/op-control.ts:334

Cancel the stream and clean up. Safe to call before the async real-channel open has completed — it flags closed so the pending open bails out.

Returns

void


isPaused()

isPaused(opId): boolean

Defined in: src/op-control.ts:319

Parameters

opId

string

Returns

boolean


isTerminated()

isTerminated(opId): boolean

Defined in: src/op-control.ts:323

Parameters

opId

string

Returns

boolean


start()

start(): void

Defined in: src/op-control.ts:235

Open the stream and wire reader handlers. Public so tests can call directly after constructing with a hand-rolled client.

Returns

void


streamAlive()

streamAlive(): boolean

Defined in: src/op-control.ts:327

Returns

boolean


waitForOp()

waitForOp(opId, opts?): Promise<void>

Defined in: src/op-control.ts:295

Block until opId is runnable, or reject on terminate.

Resolves immediately when the op is not currently paused. When paused, waits up to timeoutMs for a resume signal. Rejects with OpTerminatedError if the op has been (or becomes) terminated.

A timeout resolves normally — the caller can inspect isPaused or retry. Matches the cooperative-pause expectation in the architecture doc (the SDK yields, it doesn't deadline-enforce).

Parameters

opId

string

opts?
timeoutMs?

number

Returns

Promise<void>


connect()

static connect(gatewayUrl, opts): OpControlSubscriber

Defined in: src/op-control.ts:193

Open the gRPC channel + subscription stream and start the reader.

Returns synchronously. On the real-connect path the channel is opened asynchronously — @grpc/grpc-js and PolicyServiceClient are loaded lazily (await import) so that importing this module never eagerly pulls grpc (see the module header). The test seam (clientFactory) opens synchronously and never touches grpc.

Parameters

gatewayUrl

string

opts

OpControlSubscriberOptions

Returns

OpControlSubscriber