Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

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.

5 exports Added in v4.0.0 Source

Layers

layer

Added in v4.0.0 Source

Builds the Node cluster socket sharding layer, configuring RPC serialization, message storage, runner health checks, and optional client-only mode.

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?: "binary" | "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 maxResidentEntities: number | "unbounded";
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 unprocessedMessageBatchSize: number;
}>;
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 unstable

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>

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