FileLockManager.js 624 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.FileLockManager = void 0;
  4. class FileLockManager {
  5. constructor() {
  6. this.locks = new Map();
  7. }
  8. acquireLock(path) {
  9. if (this.locks.get(path)) {
  10. return false;
  11. }
  12. this.locks.set(path, true);
  13. return true;
  14. }
  15. releaseLock(path) {
  16. this.locks.delete(path);
  17. }
  18. isLocked(path) {
  19. return this.locks.get(path) ?? false;
  20. }
  21. clear() {
  22. this.locks.clear();
  23. }
  24. }
  25. exports.FileLockManager = FileLockManager;
  26. //# sourceMappingURL=FileLockManager.js.map