Type Alias: CyclicBuffer<T> 
CyclicBuffer<
T> =object
Defined in: primitives/buffer.ts:9
A concurrent async buffer allowing multiple readers to consume values independently. Each reader sees only new values written after attachment.
Type Parameters 
T 
T = any
The type of the values in the buffer.
Methods 
write() 
write(
value):Promise<void>
Defined in: primitives/buffer.ts:16
Writes a new value to the buffer. For single-value buffers, this operation may wait for existing readers to consume the previous value before writing.
Parameters 
value 
T
The value to write.
Returns 
Promise<void>
A promise that resolves when the write is complete.
error() 
error(
err):Promise<void>
Defined in: primitives/buffer.ts:22
Writes an error to the buffer, causing all subsequent reads to throw the error.
Parameters 
err 
Error
The error to write.
Returns 
Promise<void>
A promise that resolves when the error is recorded.
read() 
read(
readerId):Promise<IteratorResult<T,void>>
Defined in: primitives/buffer.ts:29
Reads the next available value for a specific reader. This operation will wait if no new value is available.
Parameters 
readerId 
number
The ID of the reader.
Returns 
Promise<IteratorResult<T, void>>
A promise that resolves with the next value or signals completion.
peek() 
peek(
readerId):Promise<IteratorResult<T,void>>
Defined in: primitives/buffer.ts:36
Peeks at the next available value for a specific reader without consuming it. This is a non-blocking check.
Parameters 
readerId 
number
The ID of the reader.
Returns 
Promise<IteratorResult<T, void>>
A promise that resolves with the next value, an undefined value if none is available, or signals completion.
complete() 
complete():
Promise<void>
Defined in: primitives/buffer.ts:42
Completes the buffer, signaling that no more values will be written. All active readers will receive a completion signal after consuming any remaining buffered values.
Returns 
Promise<void>
A promise that resolves when the completion signal is sent.
attachReader() 
attachReader():
Promise<number>
Defined in: primitives/buffer.ts:47
Attaches a new reader to the buffer, starting from the current state.
Returns 
Promise<number>
A promise that resolves with a unique ID for the new reader.
detachReader() 
detachReader(
readerId):Promise<void>
Defined in: primitives/buffer.ts:53
Detaches a reader from the buffer, cleaning up any associated resources.
Parameters 
readerId 
number
The ID of the reader to detach.
Returns 
Promise<void>
A promise that resolves when the reader is detached.
completed() 
completed(
readerId):boolean
Defined in: primitives/buffer.ts:59
Checks if a specific reader has reached the end of the buffer.
Parameters 
readerId 
number
The ID of the reader.
Returns 
boolean
true if the reader has completed, false otherwise.