/** A queue is an abstract data-type. See the wikipedia for more info: https://en.wikipedia.org/wiki/Queue_(abstract_data_type) * Queues are what is called a First-In First-Out (FIFO) data-type. What that means is what ever is entered into the queue first * with the enqueue command will also exit the queue first with its dequeue command. FIFO is as opposed to Last-In First-Out (LIFO) * (which is also known as First-In Last-Out (FILO)). LIFO is usually implemented with what is called a stack. * * FAQ: * Why are the methods queue and enqueue async? * The methods queue and enqueue are async so we can store the queue in redis or a similar cache if we want to * which will then make the URL-frontier more easily distributable across machines. * * @example * // You can use a self-invoked anonymous async function if you are not in an async function already. * // We use async functions so we can use await. * (async () => { * // Create the queue. * const queue = new AsyncQueue(); * // Put items into the queue: * await queue.enqueue("foo"); * await queue.enqueue("bar"); * // Take items out of queue * console.log(await queue.dequeue()); // logs "foo". * console.log(await queue.dequeue()); // logs "bar". * })(); @example * // You can use a self-invoked anonymous async function if you are not in an async function already. * // We use async functions so we can use await. * (async () => { * // Create the queue from an iterable. * const queue = await AsyncQueue.from(["foo", "bar"]); * console.log(await queue.dequeue()); // logs "foo". * console.log(await queue.dequeue()); // logs "bar". * })(); */ export declare class AsyncQueue { #private; /** This method allows to take from the queue. */ dequeue(): Promise; /** This method allows to add to the queue. */ enqueue(item: T): Promise; size(): Promise; /** This method creates a queue from an Iterable. * It is async because the items take time to enqueue **/ static from(items: Iterable): Promise>; [Symbol.asyncIterator](): { next: () => Promise<{ value: T; done: boolean; }>; throw: () => Promise<{ value: undefined; done: boolean; }>; return: () => Promise<{ value: undefined; done: boolean; }>; }; } //# sourceMappingURL=AsyncQueue.d.ts.map