/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Bytes } from "#util/Bytes.js"; import { MatterError } from "../MatterError.js"; import { MaybePromise } from "../util/Promises.js"; import { SupportedStorageTypes } from "./StringifyTools.js"; export declare class StorageError extends MatterError { } /** * Matter.js uses this key/value API to manage persistent state. */ export declare abstract class Storage { abstract readonly initialized: boolean; abstract initialize(): MaybePromise; abstract close(): MaybePromise; abstract get(contexts: string[], key: string): MaybePromise; abstract set(contexts: string[], values: Record): MaybePromise; abstract set(contexts: string[], key: string, value: SupportedStorageTypes): MaybePromise; abstract delete(contexts: string[], key: string): MaybePromise; abstract keys(contexts: string[]): MaybePromise; abstract values(contexts: string[]): MaybePromise>; abstract contexts(contexts: string[]): MaybePromise; abstract clearAll(contexts: string[]): MaybePromise; abstract clear(completely?: boolean): MaybePromise; /** * Checks if a key exists in the storage for the given contexts. * Important Note: This default implementation just reads the value for the key and checks if it is undefined. * Please implement this method in your storage implementation if you want to optimize it. */ has(contexts: string[], key: string): MaybePromise; abstract openBlob(contexts: string[], key: string): MaybePromise; abstract writeBlobFromStream(contexts: string[], key: string, stream: ReadableStream): MaybePromise; } /** * Extended interface for storage that supports snapshotting. */ export interface CloneableStorage { clone(): MaybePromise; } export declare namespace CloneableStorage { function is(storage: T): storage is T & CloneableStorage; function assert(storage: T): asserts storage is T & CloneableStorage; } //# sourceMappingURL=Storage.d.ts.map