NodeClusterSocket
Node.js socket layers for Effect Cluster runners.
The main layer builds a sharding layer for socket transport, choosing serialization, runner health checks, runner storage, message storage, and optional client-only mode from the supplied options. This module also re-exports the shared socket client and server protocol layers, and provides Kubernetes-aware Undici dispatcher and HTTP client layers for runner health checks.
Layers
Signature
declare function layer<ClientOnly extends boolean = false, Storage extends "local" | "sql" | "byo" = never>(options?: {
readonly clientOnly?: ClientOnly;
readonly runnerHealth?: "ping" | "k8s";
readonly runnerHealthK8s?: {
readonly labelSelector?: string;
readonly namespace?: string;
};
readonly serialization?: "msgpack" | "ndjson";
readonly serializationMaxBufferSize?: number | "unbounded";
readonly shardingConfig?: Partial<{
readonly assignedShardGroups: readonly Array<string>;
readonly availableShardGroups: readonly Array<string>;
readonly entityMailboxCapacity: number | "unbounded";
readonly entityMaxIdleTime: Input;
readonly entityMessagePollInterval: Input;
readonly entityRegistrationTimeout: Input;
readonly entityReplyPollInterval: Input;
readonly entityTerminationTimeout: Input;
readonly preemptiveShutdown: boolean;
readonly refreshAssignmentsInterval: Input;
readonly runnerAddress: Option<RunnerAddress>;
readonly runnerHealthCheckInterval: Input;
readonly runnerListenAddress: Option<RunnerAddress>;
readonly runnerShardWeight: number;
readonly sendRetryInterval: Input;
readonly shardLockDisableAdvisory: boolean;
readonly shardLockExpiration: Input;
readonly shardLockRefreshInterval: Input;
readonly shardsPerGroup: number;
readonly simulateRemoteSerialization: boolean;
}>;
readonly storage?: Storage;
}): ClientOnly extends true ? Layer<Sharding | Runners | "byo" extends Storage ? never : MessageStorage, ConfigError, "local" extends Storage ? never : "byo" extends Storage ? MessageStorage | RunnerStorage : SqlClient> : Layer<Sharding | Runners | "byo" extends Storage ? never : MessageStorage, ConfigError | SocketServerError, "local" extends Storage ? never : "byo" extends Storage ? MessageStorage | RunnerStorage : SqlClient>layerDispatcherK8s
Added in v4.0.0
Source
Provides an Undici dispatcher for Kubernetes API calls, using the service account CA certificate when it is available and falling back to the default dispatcher otherwise.
Signature
declare const layerDispatcherK8s: Layer.Layer<NodeHttpClient.Dispatcher>;layerK8sHttpClient
Added in v4.0.0
Source
Provides a K8sHttpClient backed by the Undici HTTP client and the Kubernetes-aware dispatcher.
Signature
declare const layerK8sHttpClient: Layer.Layer<K8sHttpClient.K8sHttpClient>;Other
Signature
declare const layerClientProtocol: any;
Builds the Node cluster socket sharding layer, configuring RPC serialization, message storage, runner health checks, and optional client-only mode.