applyBatchSync method

void applyBatchSync(
  1. List<WalOp> ops
)

Applies puts and deletes as one WAL frame.

A crash either keeps the whole batch or none of it, which is what lets a document and its derived entries (index, reverse reference) land together.

Implementation

void applyBatchSync(List<WalOp> ops) {
  _checkWritable();
  _checkOpen();
  if (ops.isEmpty) return;
  if (_txOps != null) {
    for (final op in ops) {
      _record(
        op.kind == WalOpKind.put
            ? WalOp.put(op.key, Uint8List.fromList(op.value!))
            : WalOp.delete(op.key),
      );
    }
    return;
  }
  _applyBatch(ops);
}