import { LogContext } from '@rocicorp/logger';
import type { PostgresDB } from '../../types/pg.ts';
import type { ShardID } from '../../types/shards.ts';
import type { Sink, Source } from '../../types/streams.ts';
import { type ChangeStreamData, type ChangeStreamMessage } from '../change-source/protocol/current/downstream.ts';
import type { ChangeSourceUpstream } from '../change-source/protocol/current/upstream.ts';
import type { SubscriptionState } from '../replicator/schema/replication-state.ts';
import { type ChangeStreamerService } from './change-streamer.ts';
/**
 * Performs initialization and schema migrations to initialize a ChangeStreamerImpl.
 */
export declare function initializeStreamer(lc: LogContext, shard: ShardID, taskID: string, discoveryAddress: string, discoveryProtocol: string, changeDB: PostgresDB, changeSource: ChangeSource, subscriptionState: SubscriptionState, autoReset: boolean, setTimeoutFn?: typeof setTimeout): Promise<ChangeStreamerService>;
/**
 * Internally all Downstream messages (not just commits) are given a watermark.
 * These are used for internal ordering for:
 * 1. Replaying new changes in the Storer
 * 2. Filtering old changes in the Subscriber
 *
 * However, only the watermark for `Commit` messages are exposed to
 * subscribers, as that is the only semantically correct watermark to
 * use for tracking a position in a replication stream.
 */
export type WatermarkedChange = [watermark: string, ChangeStreamData];
export type ChangeStream = {
    changes: Source<ChangeStreamMessage>;
    /**
     * A Sink to push the {@link StatusMessage}s that reflect Commits
     * that have been successfully stored by the {@link Storer}, or
     * downstream {@link StatusMessage}s henceforth.
     */
    acks: Sink<ChangeSourceUpstream>;
};
/** Encapsulates an upstream-specific implementation of a stream of Changes. */
export interface ChangeSource {
    /**
     * Starts a stream of changes starting after the specific watermark,
     * with a corresponding sink for upstream acknowledgements.
     */
    startStream(afterWatermark: string): Promise<ChangeStream>;
}
//# sourceMappingURL=change-streamer-service.d.ts.map