import * as Chunk from "../Collections/Immutable/Chunk/core.js";
import type { AtomicBoolean } from "../Support/AtomicBoolean/index.js";
import type { MutableQueue } from "../Support/MutableQueue/index.js";
import * as T from "./effect.js";
import * as P from "./promise.js";
import type { XQueue } from "./xqueue.js";
export { Dequeue, Queue, XQueue } from "./xqueue.js";
export interface Strategy {
readonly handleSurplus: (as: Chunk.Chunk, queue: MutableQueue, takers: MutableQueue>, isShutdown: AtomicBoolean) => T.UIO;
readonly unsafeOnQueueEmptySpace: (queue: MutableQueue, takers: MutableQueue>) => void;
readonly surplusSize: number;
readonly shutdown: T.UIO;
}
export declare class DroppingStrategy implements Strategy {
handleSurplus(_as: Chunk.Chunk, _queue: MutableQueue, _takers: MutableQueue>, _isShutdown: AtomicBoolean): T.UIO;
unsafeOnQueueEmptySpace(_queue: MutableQueue): void;
get shutdown(): T.UIO;
get surplusSize(): number;
}
export declare class SlidingStrategy implements Strategy {
handleSurplus(as: Chunk.Chunk, queue: MutableQueue, takers: MutableQueue>, _isShutdown: AtomicBoolean): T.UIO;
unsafeOnQueueEmptySpace(_queue: MutableQueue): void;
get shutdown(): T.UIO;
get surplusSize(): number;
private unsafeSlidingOffer;
}
export declare function unsafeCompletePromise(p: P.Promise, a: A): void;
export declare function unsafeCompleteTakers(strategy: Strategy, queue: MutableQueue, takers: MutableQueue>): void;
export declare function unsafeRemove(q: MutableQueue, a: A): void;
export declare function unsafePollN(q: MutableQueue, max: number): Chunk.Chunk;
export declare function unsafeOfferAll(q: MutableQueue, as: Chunk.Chunk): Chunk.Chunk;
export declare function unsafePollAll(q: MutableQueue): Chunk.Chunk;
/**
* Waits until the queue is shutdown.
* The `IO` returned by this method will not resume until the queue has been shutdown.
* If the queue is already shutdown, the `IO` will resume right away.
*/
export declare function awaitShutdown(self: XQueue): T.UIO;
/**
* How many elements can hold in the queue
*/
export declare function capacity(self: XQueue): number;
/**
* `true` if `shutdown` has been called.
*/
export declare function isShutdown(self: XQueue): T.UIO;
/**
* Places one value in the queue.
*
* @ets_data_first offer_
*/
export declare function offer(a: A): (self: XQueue) => T.Effect;
/**
* Places one value in the queue.
*/
export declare function offer_(self: XQueue, a: A): T.Effect;
/**
* Places one value in the queue.
*
* @ets_data_first offerTo_
*/
export declare function offerTo(self: XQueue): (a: A) => T.Effect;
/**
* Places one value in the queue.
*
* @ets_data_first offerTo_
*/
export declare function offerTo_(a: A, self: XQueue): T.Effect;
/**
* For Bounded Queue: uses the `BackPressure` Strategy, places the values in the queue and always returns true.
* If the queue has reached capacity, then
* the fiber performing the `offerAll` will be suspended until there is room in
* the queue.
*
* For Unbounded Queue:
* Places all values in the queue and returns true.
*
* For Sliding Queue: uses `Sliding` Strategy
* If there is room in the queue, it places the values otherwise it removes the old elements and
* enqueues the new ones. Always returns true.
*
* For Dropping Queue: uses `Dropping` Strategy,
* It places the values in the queue but if there is no room it will not enqueue them and return false.
*
* @ets_data_first offerAll_
*/
export declare function offerAll(as: Iterable): (self: XQueue) => T.Effect;
/**
* For Bounded Queue: uses the `BackPressure` Strategy, places the values in the queue and always returns true.
* If the queue has reached capacity, then
* the fiber performing the `offerAll` will be suspended until there is room in
* the queue.
*
* For Unbounded Queue:
* Places all values in the queue and returns true.
*
* For Sliding Queue: uses `Sliding` Strategy
* If there is room in the queue, it places the values otherwise it removes the old elements and
* enqueues the new ones. Always returns true.
*
* For Dropping Queue: uses `Dropping` Strategy,
* It places the values in the queue but if there is no room it will not enqueue them and return false.
*/
export declare function offerAll_(self: XQueue, as: Iterable): T.Effect;
/**
* Interrupts any fibers that are suspended on `offer` or `take`.
* Future calls to `offer*` and `take*` will be interrupted immediately.
*/
export declare function shutdown(self: XQueue): T.UIO;
/**
* Retrieves the size of the queue, which is equal to the number of elements
* in the queue. This may be negative if fibers are suspended waiting for
* elements to be added to the queue.
*/
export declare function size(self: XQueue): T.UIO;
/**
* Removes the oldest value in the queue. If the queue is empty, this will
* return a computation that resumes when an item has been added to the queue.
*/
export declare function take(self: XQueue): T.Effect;
/**
* Removes all the values in the queue and returns the list of the values. If the queue
* is empty returns empty list.
*/
export declare function takeAll(self: XQueue): T.Effect>;
/**
* Takes up to max number of values in the queue.
*
* @ets_data_first takeAllUpTo_
*/
export declare function takeAllUpTo(n: number): (self: XQueue) => T.Effect>;
/**
* Takes up to max number of values in the queue.
*/
export declare function takeAllUpTo_(self: XQueue, n: number): T.Effect>;
//# sourceMappingURL=core.d.ts.map