/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { ClientNode } from "#node/ClientNode.js"; import { Duration, StorageDriver } from "@matter/general"; import type { ClientNodeStore } from "./ClientNodeStore.js"; import type { DatasourceCache } from "./DatasourceCache.js"; /** * Buffers client cache writes and flushes them periodically in a single storage transaction. * * Instead of persisting every attribute change immediately, dirty caches are tracked and flushed together. This * allows WAL-based storage drivers to coalesce all dirty data into a single log entry. */ export declare class ClientCacheBuffer { #private; constructor(storageDriver: StorageDriver, flushInterval: Duration); /** * If buffering is configured on the parent ServerNode, set up the buffer on the store. The first call creates * the buffer and starts the timer; subsequent calls reuse it. * * The flush interval defaults to the storage driver's {@link StorageDriver#writeCoalescingInterval}. An interval * of `Instant` disables buffering. */ static configure(node: ClientNode, store: ClientNodeStore): void; /** * Mark a cache as having dirty data that needs flushing. */ markDirty(cache: DatasourceCache): void; /** * Remove a cache from the dirty set (e.g. on erase or reclaim). */ removeDirty(cache: DatasourceCache): void; /** * Schedule a flush. The flush runs serialized through the mutex; the promise is tracked internally. Safe to * call from sync contexts. */ initiateFlush(): void; /** * Flush all dirty caches to storage in a single transaction. Awaits completion. */ flush(): Promise; /** * Resolves once the flushes running or scheduled so far have completed, without scheduling another one. */ settled(): Promise; /** * Stop the timer and flush any remaining dirty data. */ close(): Promise; } //# sourceMappingURL=ClientCacheBuffer.d.ts.map