/** * Waiter provides synchronous wrappers for asynchronous NeoFS operations. * * After sending a request (like creating a container), NeoFS operations are * asynchronous - the data needs to propagate through the network. The waiter * polls the network until the operation is confirmed. */ import { NeoFSClient } from '../client'; import { ContainerID, ObjectID, Address } from '../types'; import { ContainerPutParams } from '../client/container'; import { ObjectPutParams } from '../client/object'; /** * Default interval between confirmation checks (in milliseconds). */ export declare const DEFAULT_POLL_INTERVAL = 1000; /** * Error thrown when a confirmation timeout occurs. * Note: This doesn't necessarily mean the operation failed - the request * was sent successfully, but confirmation timed out. */ export declare class ConfirmationTimeoutError extends Error { constructor(operation: string); } /** * Options for waiter operations. */ export interface WaiterOptions { /** * Interval between confirmation checks in milliseconds. * @default 1000 */ pollInterval?: number; /** * Maximum time to wait for confirmation in milliseconds. * @default 30000 */ timeout?: number; /** * Delay in milliseconds before the first confirmation check. * Use when the service needs a moment after Put before Get can see the resource (e.g. gateway propagation). * @default 2000 */ initialDelay?: number; } /** * Waiter provides synchronous alternatives to asynchronous NeoFS operations. * * Example: * ```typescript * const waiter = new Waiter(client); * * // Create container and wait for it to be available * const containerId = await waiter.containerPut({ * container: { * basicAcl: 0x1fbf8cff, * placementPolicy: { replicas: [{ count: 2, selector: '' }], ... }, * ... * } * }); * * // Container is now confirmed to exist * const info = await client.container().get({ containerId }); * ``` */ export declare class Waiter { private client; private defaultPollInterval; private defaultTimeout; constructor(client: NeoFSClient, options?: WaiterOptions); /** * Set the default poll interval. */ setPollInterval(interval: number): void; /** * Set the default timeout. */ setTimeout(timeout: number): void; /** * Create a container and wait until it's confirmed to exist. * * @param params - Container creation parameters * @param waiterOptions - Waiter-specific options * @returns The container ID once confirmed */ containerPut(params: ContainerPutParams, waiterOptions?: WaiterOptions): Promise; /** * Delete a container and wait until it's confirmed to be gone. * * @param containerId - The container ID to delete * @param waiterOptions - Waiter-specific options */ containerDelete(containerId: ContainerID, waiterOptions?: WaiterOptions): Promise; /** * Upload an object and wait until it's confirmed to exist. * * @param params - Object upload parameters * @param waiterOptions - Waiter-specific options * @returns The object ID once confirmed */ objectPut(params: ObjectPutParams, waiterOptions?: WaiterOptions): Promise; /** * Delete an object and wait until it's confirmed to be gone. * * @param address - The object address (containerId + objectId) to delete * @param waiterOptions - Waiter-specific options */ objectDelete(address: Address, waiterOptions?: WaiterOptions): Promise; }