/**
 * Fail-safe, bounded export queue with exponential-backoff retry.
 *
 * Guarantees:
 * - Never blocks the caller — all export work is dequeued asynchronously.
 * - Never throws — all errors are caught and logged.
 * - Drops oldest entries when full (back-pressure relief).
 * - Drains best-effort on shutdown with a configurable timeout.
 */
import type { ReadableSpan } from '../types.js';
import type { ExportQueueConfig, ExportResultCallback, ExportFn } from './types.js';
/**
 * Bounded in-memory export queue with retry and overflow protection.
 *
 * @example
 * ```ts
 * const queue = new ExportQueue(
 *   async (batch) => {
 *     await fetch('http://localhost:4318/v1/traces', {
 *       method: 'POST',
 *       body: JSON.stringify(batch),
 *     });
 *   },
 *   { maxSize: 64, drainTimeoutMs: 3000, retry: { maxRetries: 2, baseDelayMs: 50, backoffFactor: 2, maxDelayMs: 1000 } },
 * );
 *
 * queue.enqueue(spans);
 * await queue.drain();
 * ```
 */
export declare class ExportQueue {
    private readonly _config;
    private readonly _exportFn;
    private readonly _onResult?;
    /** Ring buffer holding pending batches. */
    private readonly _ring;
    private _head;
    private _tail;
    private _size;
    /** True while a drain loop is running. */
    private _draining;
    /** True after shutdown() is called — no new enqueues accepted. */
    private _shutdown;
    /**
     * @param exportFn - The actual export implementation. Must not throw.
     * @param config - Queue configuration. Merged with defaults.
     * @param onResult - Optional callback invoked after each export attempt.
     */
    constructor(exportFn: ExportFn<ReadableSpan>, config?: Partial<ExportQueueConfig>, onResult?: ExportResultCallback);
    /** Number of batches currently in the queue. */
    get size(): number;
    /** Whether the queue is currently draining. */
    get draining(): boolean;
    /**
     * Enqueue a batch of spans for export.
     *
     * - If the queue is full, the oldest entry is dropped to make room.
     * - Starts the drain loop if not already running.
     * - No-op after shutdown().
     */
    enqueue(batch: ReadableSpan[]): void;
    /**
     * Drain all queued batches best-effort, honouring drainTimeoutMs.
     * Waits until the queue is empty or the timeout elapses.
     */
    drain(): Promise<void>;
    /**
     * Stop accepting new entries and drain remaining batches.
     * Returns after drain completes or drainTimeoutMs elapses.
     */
    shutdown(): Promise<void>;
    /** Starts the async drain loop if not already running. */
    private _startDrainLoop;
    /** Continuously drains entries until the queue is empty. */
    private _drainLoop;
    /** Dequeues and returns the oldest entry, or undefined if empty. */
    private _dequeue;
    /**
     * Attempts to export a single batch with retry/backoff.
     * Never throws.
     */
    private _processEntry;
    /** Safely invokes the result callback without throwing. */
    private _emitResult;
}
//# sourceMappingURL=queue.d.ts.map