import type { Cluster } from "../abstract/Cluster";
import type { TimelineStorageOptions } from "../ent/TimelineStorage";
import { TimelineStorage } from "../ent/TimelineStorage";
import { type PickPartial } from "../internal/misc";
import type { PgClient } from "./PgClient";
export interface PgTimelineStorageOptions extends TimelineStorageOptions {
    cluster: Cluster<PgClient>;
    table?: string;
}
/**
 * An append-only (with compaction) timeline storage for PG. The timelines are
 * always appended to the table, but from time to time, when the number of
 * chunks per principal exceeds the limit, the timelines are read back,
 * compacted and written back as a single row. This is race condition safe,
 * since timelines merging is an associative and idempotent operation, i.e.
 * (T1+T2)+T3 == T1+(T2+T3); in the worst case, we'll just have slightly
 * suboptimal timeline rows.
 *
 * The expected table schema is:
 * ```
 * CREATE UNLOGGED TABLE timelines(
 *   id bigserial PRIMARY KEY,
 *   principal text NOT NULL,
 *   data text NOT NULL,
 *   created_at timestamptz NOT NULL
 * );
 * CREATE INDEX timelines_principal ON timelines (principal);
 * ```
 *
 * Notes:
 * 1. Index on `principal` must be non-unique, since there may be multiple
 *    records with the same value.
 * 2. The `id` field should have sequential auto-increment, since it's used for
 *    garbage collection.
 * 3. The table must exist in all microshards (including global shard).
 */
export declare class PgTimelineStorage extends TimelineStorage {
    /** Default values for the constructor options. */
    static readonly DEFAULT_OPTIONS: Required<PickPartial<PgTimelineStorageOptions>>;
    /** PgTimelineStorage configuration options. */
    readonly options: Required<PgTimelineStorageOptions>;
    /**
     * Initializes an instance of PgTimelineStorage.
     */
    constructor(options: PgTimelineStorageOptions);
    load(principal: string): Promise<string[]>;
    save(principal: string, dataStr: string): Promise<void>;
    private query;
}
//# sourceMappingURL=PgTimelineStorage.d.ts.map