(self: TxQueueState): Effect.Effect<boolean>Checks whether the queue is at capacity.
Example (Checking whether a queue is full)
import { Effect, TxQueue } from "effect"
const program = Effect.gen(function*() {
const queue = yield* TxQueue.bounded<number>(2)
const full = yield* TxQueue.isFull(queue)
console.log(full) // false
yield* TxQueue.offerAll(queue, [1, 2])
const nowFull = yield* TxQueue.isFull(queue)
console.log(nowFull) // true
})combinators
Source effect/TxQueue.ts:11054 lines
export const const isFull: (
self: TxQueueState
) => Effect.Effect<boolean>
Checks whether the queue is at capacity.
Example (Checking whether a queue is full)
import { Effect, TxQueue } from "effect"
const program = Effect.gen(function*() {
const queue = yield* TxQueue.bounded<number>(2)
const full = yield* TxQueue.isFull(queue)
console.log(full) // false
yield* TxQueue.offerAll(queue, [1, 2])
const nowFull = yield* TxQueue.isFull(queue)
console.log(nowFull) // true
})
isFull = (self: TxQueueState(parameter) self: {
strategy: "bounded" | "unbounded" | "dropping" | "sliding";
capacity: number;
items: TxChunk.TxChunk<any>;
stateRef: TxRef.TxRef<State<any, any>>;
toString: () => string;
toJSON: () => unknown;
}
self: TxQueueState): import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<boolean> =>
self: TxQueueState(parameter) self: {
strategy: "bounded" | "unbounded" | "dropping" | "sliding";
capacity: number;
items: TxChunk.TxChunk<any>;
stateRef: TxRef.TxRef<State<any, any>>;
toString: () => string;
toJSON: () => unknown;
}
self.TxQueueState.capacity: numbercapacity === var Number: NumberConstructorAn object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.
Number.NumberConstructor.POSITIVE_INFINITY: numberA value greater than the largest number that can be represented in JavaScript.
JavaScript displays POSITIVE_INFINITY values as infinity.
POSITIVE_INFINITY
? import EffectEffect.succeed(false)
: import EffectEffect.map(const size: (
self: TxQueueState
) => Effect.Effect<number>
Gets the current size of the queue.
Example (Reading queue size)
import { Effect, TxQueue } from "effect"
const program = Effect.gen(function*() {
const queue = yield* TxQueue.bounded<number>(10)
yield* TxQueue.offerAll(queue, [1, 2, 3])
const size = yield* TxQueue.size(queue)
console.log(size) // 3
})
size(self: TxQueueState(parameter) self: {
strategy: "bounded" | "unbounded" | "dropping" | "sliding";
capacity: number;
items: TxChunk.TxChunk<any>;
stateRef: TxRef.TxRef<State<any, any>>;
toString: () => string;
toJSON: () => unknown;
}
self), (currentSize: anycurrentSize) => currentSize: anycurrentSize >= self: TxQueueState(parameter) self: {
strategy: "bounded" | "unbounded" | "dropping" | "sliding";
capacity: number;
items: TxChunk.TxChunk<any>;
stateRef: TxRef.TxRef<State<any, any>>;
toString: () => string;
toJSON: () => unknown;
}
self.TxQueueState.capacity: numbercapacity)Referenced by 1 symbols