import { OutgoingOp } from "../../types.js";

//#region src/components/execution/lazyOps.d.ts

/**
 * Buffer for opcode-only sync ops (e.g. `DeferAdd`). These ops need to be
 * buffered until the next outbound wire message (e.g. checkpointing a
 * `step.run`).
 *
 * The engine owns shipping. This helper owns the buffer.
 */
declare class LazyOps {
  private buffer;
  private pushedIds;
  /**
   * Number of ops waiting to ship.
   */
  get length(): number;
  /**
   * Whether an op with this hashed id has been pushed in this execution
   * (whether or not it has since been drained).
   */
  hasId(id: string): boolean;
  /**
   * Take ownership of buffered ops and clear the buffer. Callers ship them on
   * whichever wire message comes next.
   */
  drain(): OutgoingOp[];
  /**
   * Buffer an op for later shipment.
   */
  push(op: OutgoingOp): void;
  /**
   * Record that an id has been observed in this execution without buffering
   * an op for it. Used to consume a `priorDefers` replay match so that
   * subsequent encounters of the same id surface as duplicates.
   */
  markSeen(id: string): void;
}
//#endregion
export { LazyOps };
//# sourceMappingURL=lazyOps.d.ts.map