import type { LogContext } from '@rocicorp/logger';
import type { StatementRunner } from '../../db/statements.ts';
import type { ChangeStreamData } from '../change-source/protocol/current/downstream.ts';
import type { ReplicatorMode } from './replicator.ts';
export type ChangeProcessorMode = ReplicatorMode | 'initial-sync';
export type CommitResult = {
    watermark: string;
    schemaUpdated: boolean;
    changeLogUpdated: boolean;
};
/**
 * The ChangeProcessor partitions the stream of messages into transactions
 * by creating a {@link TransactionProcessor} when a transaction begins, and dispatching
 * messages to it until the commit is received.
 *
 * From https://www.postgresql.org/docs/current/protocol-logical-replication.html#PROTOCOL-LOGICAL-MESSAGES-FLOW :
 *
 * "The logical replication protocol sends individual transactions one by one.
 *  This means that all messages between a pair of Begin and Commit messages
 *  belong to the same transaction."
 */
export declare class ChangeProcessor {
    #private;
    constructor(db: StatementRunner, mode: ChangeProcessorMode, failService: (lc: LogContext, err: unknown) => void);
    abort(lc: LogContext): void;
    /** @return If a transaction was committed. */
    processMessage(lc: LogContext, downstream: ChangeStreamData): CommitResult | null;
}
//# sourceMappingURL=change-processor.d.ts.map