Interface: Host
Defined in: sdk/ts/sdk/src/host/roles.ts:93
A running (or startable) host: the fetch handler plus the controls a process owner needs.
Properties
events
readonlyevents:EventEmitter
Defined in: sdk/ts/sdk/src/host/roles.ts:111
In-memory side channel: emit (from cmd.emit), warning (dispatcher) and task_scheduled.
fetch
readonlyfetch:FetchHandler
Defined in: sdk/ts/sdk/src/host/roles.ts:95
The HTTP surface as a (Request) => Response. Starts the host on first call.
journal
readonlyjournal:Journal
Defined in: sdk/ts/sdk/src/host/roles.ts:113
The journal this host reads and writes.
publicUrl
publicUrl:
string|undefined
Defined in: sdk/ts/sdk/src/host/roles.ts:117
Base URL peers reach this host on. Settable, so serve can fill it after binding a port.
roles
readonlyroles:ReadonlySet<Role>
Defined in: sdk/ts/sdk/src/host/roles.ts:115
Roles this process holds.
Methods
drain()
drain(
options?):Promise<DrainResult>
Defined in: sdk/ts/sdk/src/host/roles.ts:109
Ticks until the outbox is idle or maxMs (default 25 s) runs out. Concurrent callers share one drain. Rejects on a host without the orchestrator role.
Parameters
options?
Returns
Promise<DrainResult>
start()
start():
Promise<void>
Defined in: sdk/ts/sdk/src/host/roles.ts:97
Loads the kernel, migrates the journal and starts the dispatcher. Idempotent.
Returns
Promise<void>
stop()
stop():
Promise<void>
Defined in: sdk/ts/sdk/src/host/roles.ts:102
Stops the dispatcher, waits up to SHUTDOWN_GRACE_MS for in-process handlers, then closes the journal if the host opened it from a URL. Idempotent.
Returns
Promise<void>
tick()
tick():
Promise<TickCounts>
Defined in: sdk/ts/sdk/src/host/roles.ts:104
One dispatcher pass. Rejects on a host without the orchestrator role.
Returns
Promise<TickCounts>