/** * @since 2.0.0 */ import type * as Effect from "./Effect.js"; import type * as Scope from "./Scope.js"; import type * as STM from "./STM.js"; import type * as TQueue from "./TQueue.js"; import type * as Types from "./Types.js"; /** * @since 2.0.0 * @category symbols */ export declare const TPubSubTypeId: unique symbol; /** * @since 2.0.0 * @category symbols */ export type TPubSubTypeId = typeof TPubSubTypeId; /** * @since 2.0.0 * @category models */ export interface TPubSub extends TQueue.TEnqueue { readonly [TPubSubTypeId]: { readonly _A: Types.Invariant; }; } /** * Waits until the `TPubSub` is shutdown. The `STM` returned by this method will * not resume until the queue has been shutdown. If the `TPubSub` is already * shutdown, the `STM` will resume right away. * * @since 2.0.0 * @category mutations */ export declare const awaitShutdown: (self: TPubSub) => STM.STM; /** * Creates a bounded `TPubSub` with the back pressure strategy. The `TPubSub` will retain * messages until they have been taken by all subscribers, applying back * pressure to publishers if the `TPubSub` is at capacity. * * @since 2.0.0 * @category constructors */ export declare const bounded: (requestedCapacity: number) => STM.STM>; /** * Returns the number of elements the `TPubSub` can hold. * * @since 2.0.0 * @category getters */ export declare const capacity: (self: TPubSub) => number; /** * Creates a bounded `TPubSub` with the dropping strategy. The `TPubSub` will drop new * messages if the `TPubSub` is at capacity. * * @since 2.0.0 * @category constructors */ export declare const dropping: (requestedCapacity: number) => STM.STM>; /** * Returns `true` if the `TPubSub` contains zero elements, `false` otherwise. * * @since 2.0.0 * @category getters */ export declare const isEmpty: (self: TPubSub) => STM.STM; /** * Returns `true` if the `TPubSub` contains at least one element, `false` * otherwise. * * @since 2.0.0 * @category getters */ export declare const isFull: (self: TPubSub) => STM.STM; /** * Interrupts any fibers that are suspended on `offer` or `take`. Future calls * to `offer*` and `take*` will be interrupted immediately. * * @since 2.0.0 * @category utils */ export declare const shutdown: (self: TPubSub) => STM.STM; /** * Returns `true` if `shutdown` has been called, otherwise returns `false`. * * @since 2.0.0 * @category getters */ export declare const isShutdown: (self: TPubSub) => STM.STM; /** * Publishes a message to the `TPubSub`, returning whether the message was published * to the `TPubSub`. * * @since 2.0.0 * @category mutations */ export declare const publish: { /** * Publishes a message to the `TPubSub`, returning whether the message was published * to the `TPubSub`. * * @since 2.0.0 * @category mutations */ (value: A): (self: TPubSub) => STM.STM; /** * Publishes a message to the `TPubSub`, returning whether the message was published * to the `TPubSub`. * * @since 2.0.0 * @category mutations */ (self: TPubSub, value: A): STM.STM; }; /** * Publishes all of the specified messages to the `TPubSub`, returning whether they * were published to the `TPubSub`. * * @since 2.0.0 * @category mutations */ export declare const publishAll: { /** * Publishes all of the specified messages to the `TPubSub`, returning whether they * were published to the `TPubSub`. * * @since 2.0.0 * @category mutations */ (iterable: Iterable): (self: TPubSub) => STM.STM; /** * Publishes all of the specified messages to the `TPubSub`, returning whether they * were published to the `TPubSub`. * * @since 2.0.0 * @category mutations */ (self: TPubSub, iterable: Iterable): STM.STM; }; /** * Retrieves the size of the `TPubSub`, which is equal to the number of elements * in the `TPubSub`. This may be negative if fibers are suspended waiting for * elements to be added to the `TPubSub`. * * @since 2.0.0 * @category getters */ export declare const size: (self: TPubSub) => STM.STM; /** * Creates a bounded `TPubSub` with the sliding strategy. The `TPubSub` will add new * messages and drop old messages if the `TPubSub` is at capacity. * * For best performance use capacities that are powers of two. * * @since 2.0.0 * @category constructors */ export declare const sliding: (requestedCapacity: number) => STM.STM>; /** * Subscribes to receive messages from the `TPubSub`. The resulting subscription can * be evaluated multiple times to take a message from the `TPubSub` each time. The * caller is responsible for unsubscribing from the `TPubSub` by shutting down the * queue. * * @since 2.0.0 * @category mutations */ export declare const subscribe: (self: TPubSub) => STM.STM>; /** * Subscribes to receive messages from the `TPubSub`. The resulting subscription can * be evaluated multiple times within the scope to take a message from the `TPubSub` * each time. * * @since 2.0.0 * @category mutations */ export declare const subscribeScoped: (self: TPubSub) => Effect.Effect, never, Scope.Scope>; /** * Creates an unbounded `TPubSub`. * * @since 2.0.0 * @category constructors */ export declare const unbounded: () => STM.STM>; //# sourceMappingURL=TPubSub.d.ts.map