/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ImplementationError } from "../MatterError.js";
import { BaseStorageDriver } from "./BaseStorageDriver.js";
import { DatafileRoot } from "./DatafileRoot.js";
class BlobStorageDriver extends BaseStorageDriver {
  type = "blob";
}
class FilesystemBlobStorageDriver extends BlobStorageDriver {
  #root;
  #lock;
  constructor(namespace) {
    super();
    if (namespace !== void 0) {
      if (!(namespace instanceof DatafileRoot)) {
        throw new ImplementationError("Filesystem blob storage driver requires a DatafileRoot namespace");
      }
      this.#root = namespace;
    }
  }
  get root() {
    return this.#root;
  }
  async initialize() {
    if (this.#lock) {
      throw new ImplementationError("Filesystem blob storage driver is already initialized");
    }
    if (this.#root) {
      this.#lock = await this.#root.lock();
    }
  }
  async close() {
    await this.#lock?.close();
    this.#lock = void 0;
  }
}
export {
  BlobStorageDriver,
  FilesystemBlobStorageDriver
};
//# sourceMappingURL=BlobStorageDriver.js.map
