/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Construction, MaybePromise, Observable } from "@matter/general"; import { EventNumber, EventPath, FabricIndex, Priority, TlvEventFilter, TypeFromSchema } from "@matter/types"; import { EventStore } from "./EventStore.js"; import { NumberedOccurrence, Occurrence } from "./Occurrence.js"; export interface OccurrenceManagerContext { store: EventStore; bufferConfig?: OccurrenceManager.BufferConfig; } /** * Manages event occurrences. * * Each time an event is triggered it is stored as an {@link Occurrence} in this manager. Occurrences are persisted in * an {@link EventStore} and may be retrieved using Matter query semantics. * * Drops occurrences when the store becomes too full as configured by {@link OccurrenceManager.BufferConfig}. * * TODO - query is extremely inefficient. For new code paths should build internal index and bypass EventServer to * deliver query in wire form directly here */ export declare class OccurrenceManager { #private; get construction(): Construction; static create(context: OccurrenceManagerContext): Promise; constructor({ store, bufferConfig }: OccurrenceManagerContext); get added(): Observable<[occurrence: NumberedOccurrence], void>; /** * Discard every occurrence. * * Pass {@link EventStore.ClearOptions.keepNumbering} unless the node's life ends here, as matter.js treats a * factory reset. */ clear(options?: EventStore.ClearOptions): Promise; /** * Query the event store for events matching the given path and filters. * @deprecated */ query(eventPath: EventPath, filters?: TypeFromSchema[], filterForFabricIndex?: FabricIndex): MaybePromise; /** * Return an iterator over all occurrences in the store that are bigger or equal to the minimum eventNumber, * if provided. */ get(eventMin?: EventNumber): AsyncGenerator<{ endpointId: import("@matter/types").EndpointNumber; clusterId: import("@matter/types").ClusterId; eventId: import("@matter/types").EventId; epochTimestamp: import("@matter/general").Timestamp; priority: Priority; payload: unknown; number: EventNumber; }, void, unknown>; close(): Promise; add(occurrence: Occurrence): MaybePromise; remove(number: EventNumber): MaybePromise; } export declare namespace OccurrenceManager { /** * Buffer management configuration. Controls */ interface BufferConfig { /** * The minimum number of events that will be buffered. */ minEventAllowance: number; /** * The maximum number of events that will be buffered. * * When the buffer hits this size the manager discard events to reduce the buffer size to * {@link minimumEventAllowance}. */ maxEventAllowance: number; /** * Minimum allowances by priority. This ensures a minimum number of non-critical events avoid LRU * harvesting. Critical events take the rest of the entries up to the defined global minimum. */ minPriorityEventAllowance: { info: number; debug: number; }; } const DefaultBufferConfig: BufferConfig; } //# sourceMappingURL=OccurrenceManager.d.ts.map