Skip to content

DenoClusterSocket

Native Deno 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. Unlike Node sockets, Deno connections have no native idle-timeout option, so peer connections use only the one-second open timeout.

4 exports Added in v4.0.0 Source

Layers

layer

Added in v4.0.0 Source

Creates Deno socket cluster layers, configuring serialization, storage, runner health, 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?: "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>

Provides the cluster RpcClientProtocol using native Deno TCP sockets.

Signature

declare const layerClientProtocol: Layer.Layer<
  Runners.RpcClientProtocol,
  never,
  RpcSerialization.RpcSerialization
>;

Layer that provides K8sHttpClient, using a scoped native Deno HTTP client with the Kubernetes service-account CA certificate when it is available.

Signature

declare const layerK8sHttpClient: Layer.Layer<K8sHttpClient.K8sHttpClient>;

Provides the native Deno socket server used by cluster runners, listening on ShardingConfig.runnerListenAddress or runnerAddress.

Signature

declare const layerSocketServer: Layer.Layer<
  SocketServer.SocketServer,
  SocketServer.SocketServerError,
  ShardingConfig.ShardingConfig
>;