declare const txSlotBrand: unique symbol; declare const rxSlotBrand: unique symbol; /** Zero-copy write window into the ring buffer. Valid only until commit or rollback. */ export type TxSlot = Buffer & { readonly [txSlotBrand]: true; }; /** Zero-copy read window into the ring buffer. Valid only until commit. */ export type RxSlot = Buffer & { readonly [rxSlotBrand]: true; }; /** @internal */ export interface TxController { commitTx(actualSize: number, typeId: number): void; commitTxUnflushed(actualSize: number, typeId: number): void; rollbackTx(): void; } /** @internal */ export interface RxController { commitRx(): void; getState(): number; } /** * Exclusive write lease on a ring buffer slot. * * Obtain via {@link Bus.acquireTx}. Finalize with {@link commit}, {@link commitUnflushed}, * or {@link rollback}. Failing to do so holds the producer lock indefinitely. * `using` rolls back automatically if the slot was not already committed. * * @example * ```ts * using tx = bus.acquireTx(32); * tx.bytes().write('hello', 0); * tx.commit(5, 1); * ``` */ export declare class TxGuard { #private; /** @internal */ constructor(ctrl: TxController, buffer: Buffer); /** * Returns the writable zero-copy window into shared memory. * The reference is invalidated on commit or rollback, any cached reference * will throw `TypeError` on subsequent access (underlying ArrayBuffer detached). * * @throws {Error} If the slot has already been finalized. */ bytes(): TxSlot; /** * Publishes `actualSize` bytes with `typeId` and flushes immediately. * Use for single-message sends; prefer {@link commitUnflushed} + {@link Bus.flush} for batches. * * @throws {Error} If the slot has already been finalized. */ commit(actualSize: number, typeId: number): void; /** * Publishes without flushing. Call {@link Bus.flush} after the last message in the batch. * * @throws {Error} If the slot has already been finalized. */ commitUnflushed(actualSize: number, typeId: number): void; /** Cancels the transaction without publishing. No-op if already finalized. */ rollback(): void; /** Called automatically by the `using` keyword. Rolls back if not already committed. */ [Symbol.dispose](): void; } /** * Zero-copy read lease on a ring buffer slot. * * Obtain via {@link Bus.acquireRx}. Release with {@link commit} once the payload is consumed. * Failing to do so stalls the consumer head indefinitely. * `using` commits automatically. * * @example * ```ts * using rx = bus.acquireRx(); * if (rx === null) return; // EINTR * process(rx.data()); * ``` */ export declare class RxGuard { #private; /** Message type discriminator set by the producer. */ readonly typeId: number; /** Exact payload size in bytes. */ readonly actualSize: number; /** @internal */ constructor(ctrl: RxController, buffer: Buffer, typeId: number, actualSize: number); /** * Returns the read-only zero-copy window into shared memory. * The reference is invalidated on commit, any cached reference will throw `TypeError`. * * @throws {Error} If the slot has already been committed. * @throws {PeerDeadError} If the bus has transitioned to TACHYON_STATE_FATAL_ERROR. */ data(): RxSlot; /** Releases the slot and advances the consumer head. * * @throws {Error} If the slot has already been committed. */ commit(): void; /** Called automatically by the `using` keyword. Commits if not already released. */ [Symbol.dispose](): void; } export {}; //# sourceMappingURL=guards.d.ts.map