import type { RxSlot } from './guards.ts'; /** @internal */ export interface BatchController { commitBatch(): void; getState(): number; } /** A single message inside an {@link RxBatch}. Valid only until the batch is committed. */ export interface RxMessage { readonly data: RxSlot; readonly typeId: number; readonly size: number; } /** * Zero-copy batch of ring buffer slots drained in a single native call. * * Obtain via {@link Bus.drainBatch}. Iterate the messages then call {@link commit}. * `using` commits automatically. * * All `RxMessage.data` references are invalidated on commit. Any cached reference * will throw `TypeError` (underlying ArrayBuffers are detached by the C++ side). * * @example * ```ts * using batch = bus.drainBatch(64); * for (const msg of batch) { * process(msg.data, msg.typeId); * } * ``` */ export declare class RxBatch { #private; /** @internal */ constructor(ctrl: BatchController, messages: RxMessage[]); /** Number of messages in this batch. */ get length(): number; /** * Returns the message at index `i`. * * @throws {RangeError} If `i` is out of bounds. * @throws {Error} If the batch has already been committed. * @throws {PeerDeadError} If the bus has transitioned to TACHYON_STATE_FATAL_ERROR. */ at(i: number): RxMessage; /** * Iterates over all messages. Stops immediately if the batch is committed mid-iteration. * * @throws {PeerDeadError} If the bus has transitioned to TACHYON_STATE_FATAL_ERROR. */ [Symbol.iterator](): Iterator; /** Advances the consumer head and detaches all slot ArrayBuffers. No-op if already committed. */ commit(): void; /** Called automatically by the `using` keyword. Commits if not already released. */ [Symbol.dispose](): void; } //# sourceMappingURL=batch.d.ts.map