/** * @since 1.0.0 */ import type * as Rpc from "@effect/rpc/Rpc"; import * as RpcClient from "@effect/rpc/RpcClient"; import * as Context from "effect/Context"; import type { DurationInput } from "effect/Duration"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; import * as Schedule from "effect/Schedule"; import * as Scope from "effect/Scope"; import * as Stream from "effect/Stream"; import type { MailboxFull, PersistenceError } from "./ClusterError.js"; import { AlreadyProcessingMessage, EntityNotAssignedToRunner } from "./ClusterError.js"; import type { CurrentAddress, CurrentRunnerAddress, Entity, HandlersFrom } from "./Entity.js"; import type { EntityId } from "./EntityId.js"; import * as Message from "./Message.js"; import * as MessageStorage from "./MessageStorage.js"; import * as RunnerHealth from "./RunnerHealth.js"; import { Runners } from "./Runners.js"; import { RunnerStorage } from "./RunnerStorage.js"; import type { ShardId } from "./ShardId.js"; import { ShardingConfig } from "./ShardingConfig.js"; import { type ShardingRegistrationEvent } from "./ShardingRegistrationEvent.js"; import * as Snowflake from "./Snowflake.js"; declare const Sharding_base: Context.TagClass; /** * Returns the `ShardId` of the shard to which the entity at the specified * `address` is assigned. */ readonly getShardId: (entityId: EntityId, group: string) => ShardId; /** * Returns `true` if the specified `shardId` is assigned to this runner. */ readonly hasShardId: (shardId: ShardId) => boolean; /** * Generate a Snowflake ID that is unique to this runner. */ readonly getSnowflake: Effect.Effect; /** * Returns `true` if sharding is shutting down, `false` otherwise. */ readonly isShutdown: Effect.Effect; /** * Constructs a `RpcClient` which can be used to send messages to the * specified `Entity`. */ readonly makeClient: (entity: Entity) => Effect.Effect<(entityId: string) => RpcClient.RpcClient.From>; /** * Registers a new entity with the runner. */ readonly registerEntity: , RX>(entity: Entity, handlers: Effect.Effect, options?: { readonly maxIdleTime?: DurationInput | undefined; readonly concurrency?: number | "unbounded" | undefined; readonly mailboxCapacity?: number | "unbounded" | undefined; readonly disableFatalDefects?: boolean | undefined; readonly defectRetryPolicy?: Schedule.Schedule | undefined; readonly spanAttributes?: Record | undefined; }) => Effect.Effect | Rpc.Middleware | Exclude>; /** * Registers a new singleton with the runner. */ readonly registerSingleton: (name: string, run: Effect.Effect, options?: { readonly shardGroup?: string | undefined; }) => Effect.Effect; /** * Sends a message to the specified entity. */ readonly send: (message: Message.Incoming) => Effect.Effect; /** * Sends an outgoing message */ readonly sendOutgoing: (message: Message.Outgoing, discard: boolean) => Effect.Effect; /** * Notify sharding that a message has been persisted to storage. */ readonly notify: (message: Message.Incoming, options?: { readonly waitUntilRead?: boolean | undefined; }) => Effect.Effect; /** * Reset the state of a message */ readonly reset: (requestId: Snowflake.Snowflake) => Effect.Effect; /** * Trigger a storage read, which will read all unprocessed messages. */ readonly pollStorage: Effect.Effect; /** * Retrieves the active entity count for the current runner. */ readonly activeEntityCount: Effect.Effect; }>; /** * @since 1.0.0 * @category models */ export declare class Sharding extends Sharding_base { } /** * @since 1.0.0 * @category layers */ export declare const layer: Layer.Layer; export {}; //# sourceMappingURL=Sharding.d.ts.map