/** * @since 1.0.0 */ import { type NonEmptyArray } from "effect/Array"; import * as Context from "effect/Context"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; import type { PersistenceError } from "./ClusterError.js"; import * as MachineId from "./MachineId.js"; import { Runner } from "./Runner.js"; import type { RunnerAddress } from "./RunnerAddress.js"; import { ShardId } from "./ShardId.js"; declare const RunnerStorage_base: Context.TagClass Effect.Effect; /** * Unregister the runner with the given address. */ readonly unregister: (address: RunnerAddress) => Effect.Effect; /** * Get all runners registered with the cluster. */ readonly getRunners: Effect.Effect, PersistenceError>; /** * Set the health status of the given runner. */ readonly setRunnerHealth: (address: RunnerAddress, healthy: boolean) => Effect.Effect; /** * Try to acquire the given shard ids for processing. * * It returns an array of shards it was able to acquire. */ readonly acquire: (address: RunnerAddress, shardIds: Iterable) => Effect.Effect, PersistenceError>; /** * Refresh the locks owned by the given runner. */ readonly refresh: (address: RunnerAddress, shardIds: Iterable) => Effect.Effect, PersistenceError>; /** * Release the given shard ids. */ readonly release: (address: RunnerAddress, shardId: ShardId) => Effect.Effect; /** * Release all the shards assigned to the given runner. */ readonly releaseAll: (address: RunnerAddress) => Effect.Effect; }>; /** * Represents a generic interface to the persistent storage required by the * cluster. * * @since 1.0.0 * @category models */ export declare class RunnerStorage extends RunnerStorage_base { } /** * @since 1.0.0 * @category Encoded */ export interface Encoded { /** * Get all runners registered with the cluster. */ readonly getRunners: Effect.Effect, PersistenceError>; /** * Register a new runner with the cluster. */ readonly register: (address: string, runner: string, healthy: boolean) => Effect.Effect; /** * Unregister the runner with the given address. */ readonly unregister: (address: string) => Effect.Effect; /** * Set the health status of the given runner. */ readonly setRunnerHealth: (address: string, healthy: boolean) => Effect.Effect; /** * Acquire the lock on the given shards, returning the shards that were * successfully locked. */ readonly acquire: (address: string, shardIds: NonEmptyArray) => Effect.Effect, PersistenceError>; /** * Refresh the lock on the given shards, returning the shards that were * successfully locked. */ readonly refresh: (address: string, shardIds: Array) => Effect.Effect, PersistenceError>; /** * Release the lock on the given shard. */ readonly release: (address: string, shardId: string) => Effect.Effect; /** * Release the lock on all shards for the given runner. */ readonly releaseAll: (address: string) => Effect.Effect; } /** * @since 1.0.0 * @category layers */ export declare const makeEncoded: (encoded: Encoded) => { /** * Register a new runner with the cluster. */ readonly register: (runner: Runner, healthy: boolean) => Effect.Effect; /** * Unregister the runner with the given address. */ readonly unregister: (address: RunnerAddress) => Effect.Effect; /** * Get all runners registered with the cluster. */ readonly getRunners: Effect.Effect, PersistenceError>; /** * Set the health status of the given runner. */ readonly setRunnerHealth: (address: RunnerAddress, healthy: boolean) => Effect.Effect; /** * Try to acquire the given shard ids for processing. * * It returns an array of shards it was able to acquire. */ readonly acquire: (address: RunnerAddress, shardIds: Iterable) => Effect.Effect, PersistenceError>; /** * Refresh the locks owned by the given runner. */ readonly refresh: (address: RunnerAddress, shardIds: Iterable) => Effect.Effect, PersistenceError>; /** * Release the given shard ids. */ readonly release: (address: RunnerAddress, shardId: ShardId) => Effect.Effect; /** * Release all the shards assigned to the given runner. */ readonly releaseAll: (address: RunnerAddress) => Effect.Effect; }; /** * @since 1.0.0 * @category constructors */ export declare const makeMemory: Effect.Effect<{ /** * Register a new runner with the cluster. */ readonly register: (runner: Runner, healthy: boolean) => Effect.Effect; /** * Unregister the runner with the given address. */ readonly unregister: (address: RunnerAddress) => Effect.Effect; /** * Get all runners registered with the cluster. */ readonly getRunners: Effect.Effect, PersistenceError>; /** * Set the health status of the given runner. */ readonly setRunnerHealth: (address: RunnerAddress, healthy: boolean) => Effect.Effect; /** * Try to acquire the given shard ids for processing. * * It returns an array of shards it was able to acquire. */ readonly acquire: (address: RunnerAddress, shardIds: Iterable) => Effect.Effect, PersistenceError>; /** * Refresh the locks owned by the given runner. */ readonly refresh: (address: RunnerAddress, shardIds: Iterable) => Effect.Effect, PersistenceError>; /** * Release the given shard ids. */ readonly release: (address: RunnerAddress, shardId: ShardId) => Effect.Effect; /** * Release all the shards assigned to the given runner. */ readonly releaseAll: (address: RunnerAddress) => Effect.Effect; }, never, never>; /** * @since 1.0.0 * @category layers */ export declare const layerMemory: Layer.Layer; export {}; //# sourceMappingURL=RunnerStorage.d.ts.map