import { DataType, MultiSeries, Series, TimeSpan, TimeStamp } from '@synnaxlabs/x';
/** Response from a write to the @link Dynamic cache. */
export interface DynamicWriteResponse {
    /** A list of series that were flushed from the cache during the write i.e. the new
     * writes were not able to fit in the current buffer, so a new one was allocated
     * and the old one(s) were flushed. */
    flushed: MultiSeries;
    /** A list of series that were allocated during the write. */
    allocated: MultiSeries;
}
/** Props for the @link Dynamic cache. */
export interface DynamicProps {
    /**
     * Sets the maximum size of the buffer that the cache will maintain before flushing
     * data out to the caller.
     */
    dynamicBufferSize: number | TimeSpan;
    /**
     * Sets the data type for the series written to the cache. Used for buffer allocation
     * purposes.
     */
    dataType: DataType;
    /**
     * Function that the cache will use to pull the current time.
     */
    now?: () => TimeStamp;
}
/**
 * A cache for channel data that maintains a single, rolling Series as a buffer
 * for channel data.
 */
export declare class Dynamic {
    private readonly props;
    private counter;
    /** Current buffer */
    private curr;
    private avgRate;
    private timeOfLastWrite;
    private totalWrites;
    private now;
    /**
     * @constructor
     *
     * @param cap - The capacity of the cache buffer.
     * @param dataType - The data type of the channel.
     */
    constructor(props: DynamicProps);
    /** @returns the number of samples currently held in the cache. */
    get length(): number;
    /**
     * @returns the current buffer being written to by the cache. Under no circumstances
     * should this be modified by the caller.
     */
    get leadingBuffer(): Series | null;
    /**
     * Writes the given arrays to the cache.
     *
     * @returns a list of buffers that were filled by the cache during the write. If
     * the current buffer is able to fit all writes, no buffers will be returned.
     */
    write(series: MultiSeries): DynamicWriteResponse;
    private allocate;
    private _write;
    private updateAvgRate;
    private nextBufferSize;
    /**
     * Closes the cache and releases all resources associated with it. After close()
     * is called, the cache should not be used again.
     */
    close(): void;
}
//# sourceMappingURL=dynamic.d.ts.map