import { alamos } from '@synnaxlabs/alamos';
import { channel, framer } from '@synnaxlabs/client';
import { MultiSeries, TimeRange, TimeSpan } from '@synnaxlabs/x';
import { Cache } from './cache/cache';
import { ReadClient } from './client';
/** A function that reads a telemetry frame from the Synnax cluster. */
export interface ReadRemoteFunc {
    (tr: TimeRange, keys: channel.Keys): Promise<framer.Frame>;
}
export interface ReaderArgs {
    /**
     * Function used to read remote data from the server. Used instead of
     * passing in a Synnax client directly to make testing easier.
     */
    readRemote: ReadRemoteFunc;
    /** Will read from and populate the given cache with fetched data. */
    cache: Cache;
    /**
     * Used to batch read request to the server to minimize traffic. Larger
     * values mean slower response times but less traffic. Smaller values mean faster
     * response times but more traffic.
     * @default TimeSpan.milliseconds(50)
     */
    batchDebounce?: TimeSpan;
    /**
     * A threshold for overlap between time ranges in order for them to be batched into
     * a single request to the server. For example, a read on channel one for time range
     * [1ms, 5ms] and a read for channel two for time range [4ms, 6ms] would be batched
     * under an overlap threshold of 2ms into a single request for time range [1ms, 6ms]
     * for the channels [one, two].
     * @default TimeSpan.milliseconds(5)
     */
    overlapThreshold?: TimeSpan;
    /** Used for logging, tracing, etc. */
    instrumentation?: alamos.Instrumentation;
}
/**
 * Reader is used for reading telemetry data from the Synnax cluster. See the documentation
 * in the README for more.
 */
export declare class Reader implements ReadClient {
    /** Parsed and validated arguments passed to the constructor. */
    private readonly args;
    /**
     * A function that debounced reads to the cluster by the debounce interval
     * specified in args.batchDebounce.
     */
    private readonly debouncedRead;
    /** A mutex for serializing access to requests. */
    private readonly mu;
    constructor(args: ReaderArgs);
    /** Implements ReadClient. */
    read(tr: TimeRange, channel: channel.Key): Promise<MultiSeries>;
    private batchRead;
    close(): Promise<void>;
}
//# sourceMappingURL=reader.d.ts.map