import type { ImageFetcher, StoredImage } from './types.js'; /** * Fetches the images of the rows ahead of the row the writer is on, a few at a * time (`imageConcurrency`, ยง 8.5): images use the network and not the database, * and they dominate the duration of an import that has them. The writer still * takes the image of a row when it reaches the row, so a failure is the failure * of that row (IMP-03) and the order of what is written does not change. * * - `schedule(urls)` queues one fetch for each URL, in the order given. A URL * that appears twice is fetched twice, once for each row, as without it. * - `fetch(url)` gives the next fetch queued for that URL, started or not (it is * started as soon as there is room). A URL with nothing queued, which is the * retry of a failed fetch, is fetched again, ahead of the queue. * - `clear()` forgets what was queued and not yet started or wanted: the rest of * a batch whose rows were skipped. A fetch already running ends on its own. * - Once the run is aborted, no fetch is started that nobody is waiting for. */ export declare class ImagePrefetcher { private readonly fetcher; private readonly concurrency; private readonly signal?; private readonly queued; private readonly waiting; private active; constructor(fetcher: ImageFetcher, concurrency: number, signal?: AbortSignal | undefined); schedule(urls: Iterable): void; fetch(url: string): Promise; clear(): void; private entry; private pump; }