import { Environment } from "../environment/Environment.js"; import { Environmental } from "../environment/Environmental.js"; import { Diagnostic } from "../log/Diagnostic.js"; import { BlobStorageDriver } from "./BlobStorageDriver.js"; import { DataNamespace } from "./DataNamespace.js"; import { StorageDriver } from "./StorageDriver.js"; import { StorageManager } from "./StorageManager.js"; /** * Handle returned by {@link StorageService.openBlobStorage}. */ export interface BlobStorageHandle { readonly driver: BlobStorageDriver; close(): Promise; } /** * Service adapter for the Matter.js storage API. */ export declare class StorageService { #private; [Diagnostic.value]: () => (string | (Record & Diagnostic))[]; constructor(environment: Environment); static [Environmental.create](environment: Environment): StorageService; /** * Register a driver implementation so that it can be resolved by id. */ registerDriver(impl: StorageDriver.Implementation): void; /** * Register a blob driver implementation so that it can be resolved by id. */ registerBlobDriver(impl: BlobStorageDriver.Implementation): void; /** * Set the default driver id used when no existing storage is detected. */ set defaultDriver(id: string); get defaultDriver(): string; /** * Set the explicitly configured driver id (e.g. from user configuration). When set, triggers migration if the * existing storage uses a different driver. */ set configuredDriver(id: string | undefined); get configuredDriver(): string | undefined; /** * Set the default blob driver id used when no existing blob storage is detected. */ set defaultBlobDriver(id: string); get defaultBlobDriver(): string; /** * Set the explicitly configured blob driver id (e.g. from user configuration). When set, takes precedence over * detected or default blob driver. */ set configuredBlobDriver(id: string | undefined); get configuredBlobDriver(): string | undefined; /** * Whether a {@link Filesystem} service is installed in the environment. Callers can check this before calling * {@link open} to avoid errors in memory-only environments. */ get hasFilesystem(): boolean; /** * Whether drivers are registered. */ get isConfigured(): boolean; /** * Open storage. The storage is initialized but the caller must take ownership. * * @param namespace a unique namespace identifier (string) or a pre-built {@link DataNamespace}/{@link DatafileRoot} */ open(namespace: string | DataNamespace): Promise; /** * Close storage for a namespace previously opened with {@link open}. * * Locking is now managed by the drivers themselves via ref-counted {@link DatafileRoot.Lock}s, so this method is a * no-op retained for backward compatibility. */ close(_namespace: string): Promise; /** * Open blob storage. The storage is initialized and returned directly (no StorageManager wrapper). * * For filesystem namespaces, the blob driver type is persisted in `driver.json` with `type: "blob"`. * Detection logic: * - `driver.json` exists with `kind` → use that driver (explicit) * - No `driver.json` but directory exists → legacy implicit "file" (data from WAL or old file driver) * - No `driver.json`, no directory → fresh namespace, use default blob driver * * @param namespace a unique namespace identifier (string) or a pre-built {@link DataNamespace}/{@link DatafileRoot} */ openBlobStorage(namespace: string | DataNamespace): Promise; /** * The root filesystem path for storage, or a placeholder if no filesystem is available. */ get location(): string; } //# sourceMappingURL=StorageService.d.ts.map