import { promiseVoid } from "../../../shared/src/resolved-promises.js";
import { ReadImpl } from "./read-impl.js";
import { transactionIsClosedRejection } from "./throw-if-closed.js";
import { WriteImplBase, deleteSentinel } from "./write-impl-base.js";
class WriteImpl extends WriteImplBase {
  #map;
  constructor(map, release) {
    super(new ReadImpl(map, release));
    this.#map = map;
  }
  commit() {
    if (this.closed) {
      return transactionIsClosedRejection();
    }
    this._pending.forEach((value, key) => {
      if (value === deleteSentinel) {
        this.#map.delete(key);
      } else {
        this.#map.set(key, value);
      }
    });
    this._pending.clear();
    this.release();
    return promiseVoid;
  }
}
export {
  WriteImpl
};
//# sourceMappingURL=write-impl.js.map
