import { SqliteConnection } from "./connection.js"; import { SpanRecord, TraceExporter } from "@graphorin/observability"; //#region src/span-store.d.ts /** The span attribute the exporter keys session-scoped rows off. */ declare const SPAN_SESSION_ATTRIBUTE = "graphorin.session.id"; /** * Build a `TraceExporter` that persists finished spans into the `spans` table. * Each row records the `graphorin.session.id` attribute (when present) so a * session's spans can be read back in order. * * @stable */ declare function createSqliteSpanExporter(conn: SqliteConnection, options?: { readonly id?: string; }): TraceExporter; /** * Read a session's persisted spans back as an ordered * `AsyncIterable` - the `traceSource` shape `Session.replay()` and * the `graphorin memory why` CLI consume. Spans are ordered by start time * (then span id) so replay reproduces the original run order. * * @stable */ declare function traceSourceForSession(conn: SqliteConnection, sessionId: string): AsyncIterable; /** * Delete every persisted span of one session. Called by the * session hard-delete cascade (the `spans` entry of * `SESSION_SCOPED_PURGES`); exported for hosts that manage spans out * of band. Returns the number of rows deleted. * * @stable */ declare function deleteSpansForSession(conn: SqliteConnection, sessionId: string): number; /** * Age-based span retention: delete every span that FINISHED * before the cutoff, including rows with `session_id IS NULL` (not * attached to any session, so age is their only deletion path). The * cutoff is epoch **milliseconds** - the ns conversion happens here so * callers never juggle units; sub-ms precision loss at the 2^53 * boundary is irrelevant for retention. Backed by the * `idx_spans_end` index (migration 030), so the sweep is not a full * table scan. Returns the number of rows deleted. * * @stable */ declare function pruneSpans(conn: SqliteConnection, opts: { readonly beforeEpochMs: number; }): number; //#endregion export { SPAN_SESSION_ATTRIBUTE, createSqliteSpanExporter, deleteSpansForSession, pruneSpans, traceSourceForSession }; //# sourceMappingURL=span-store.d.ts.map