import { type RollupKey, type RollupQuery, type RollupRow, type RollupStore, type RollupTotals } from '../tracing/rollups.js'; import type { MigrationResult, SchemaMigration } from '../utils/schema-migrations.js'; import { type PostgresLikeClient } from './client.js'; import type { PostgresMigrateOptions } from './migrations.js'; /** Options for the Postgres rollup store. */ export interface PostgresRollupStoreOptions { /** Table name, optionally schema-qualified. Defaults to `nexus_rollups`. */ table?: string; } /** The schema, as statements: every migration's, in order. */ export declare function rollupStoreMigration(options?: PostgresRollupStoreOptions): string[]; /** The versioned schema, which `migrate()` and `nexus db migrate` apply. */ export declare function rollupStoreMigrations(options?: PostgresRollupStoreOptions): SchemaMigration[]; /** * Rollup rows in Postgres, so a dashboard's totals live beside its traces and survive a restart. * * Adding to a row is one `INSERT … ON CONFLICT DO UPDATE` that sums every total, latency buckets * included, so two workers finishing runs in the same hour both count. A query reads only the rows * of its range: a month of one tenant is a few hundred rows, however many runs it held. */ export declare class PostgresRollupStore implements RollupStore { private readonly client; private readonly options; private readonly table; constructor(client: PostgresLikeClient, options?: PostgresRollupStoreOptions); /** * Applies this store's pending migrations, recorded in `nexus_schema_migrations`, under a lock. * Never runs implicitly. */ migrate(options?: PostgresMigrateOptions): Promise; /** Adds totals to the row for `key`, creating it, in one statement. */ add(key: RollupKey, totals: RollupTotals): Promise; /** Rows matching a query, oldest hour first, filtered as the in-memory store filters them. */ query(query?: RollupQuery): Promise; }