/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { Endpoint } from "#endpoint/Endpoint.js"; import { DeviceTypeScopeIndex, DeviceTypeValidationPass, ReachingEndpoints } from "@matter/model"; import { ServerEndpointFacts } from "./ServerEndpointFacts.js"; /** * What the device type validation of one server node keeps of its tree across passes: the recorded entry of each * judged endpoint, the reaching endpoints of each node scope and the parts of each endpoint by device type. * * The owner reports every lifecycle change of the node's endpoints and every `DeviceTypeList` change through * {@link noteChanged}, a change to what a recorded entry read through {@link invalidate}, a recording pass through * {@link recorded}, a destroyed or reset endpoint through {@link removed} and a factory reset through {@link clear}. * * The reaching endpoints of a node scope are collected by a walk of the scope on first request and then kept equal to * what a walk would find: at the first read after noted changes, each noted endpoint and its descendants leave the * scope and join it again as they stand now. Changes are not collected while no scope is kept. * * The parts of an endpoint by device type are collected on first request and kept up to date with the device types * the facts answer at each noted change. Where the number of present parts of a device type passes from one to two or * back, the Base `Duplicate` condition of each of those parts may flip, so each becomes a {@link suspectsOf suspect} * and its contribution to its node scope is read again. */ export declare class NodeScopeIndex implements DeviceTypeScopeIndex { #private; constructor(facts: ServerEndpointFacts); /** * What the last recording pass read of {@link endpoint}. */ entryOf(endpoint: Endpoint): NodeScopeIndex.Entry | undefined; recorded(endpoint: Endpoint, entry: NodeScopeIndex.Entry): void; /** * Drop the recorded entry of {@link endpoint}, whose device types or server clusters changed, and * suspect it until a pass records it again. An entry is kept only while a fresh judgement would record the same, or a * reach {@link widen widened} beyond it. * * @returns the entry recorded before the change */ invalidate(endpoint: Endpoint): NodeScopeIndex.Entry | undefined; /** * Drop the recorded entry of {@link endpoint}, as if no pass had recorded it. Condition readers are no longer known * to be judged under any conditions. * * @internal tests only */ forget(endpoint: Endpoint): void; /** * The conditions of {@link nodeEndpoint}, as the owner compares them, that every recorded condition reader of * {@link nodeEndpoint} was last judged under; undefined when that is not known. */ readersJudgedUnder(nodeEndpoint: Endpoint): string | undefined; readersJudged(nodeEndpoint: Endpoint, conditions: string | undefined): void; /** * Widen the recorded reach of {@link owner}, which is not a node endpoint, by that of a descendant destroyed before * it, so the owner's removal answers for the descendant. */ widen(owner: Endpoint, reach: DeviceTypeValidationPass.Reach): void; noteChanged(endpoint: Endpoint): void; /** * Drop what is kept of {@link endpoint}, which is destroyed or reset. * * @returns the endpoint's recorded entry */ removed(endpoint: Endpoint): NodeScopeIndex.Entry | undefined; clear(): void; reachingOf(nodeEndpoint: Endpoint, pass: DeviceTypeValidationPass): ReachingEndpoints; scopeListing(nodeEndpoint: Endpoint, deviceTypeId: number, pass: DeviceTypeValidationPass): never[] | Set>; partsListing(parent: Endpoint, deviceTypeId: number): Iterable; /** * The parts of {@link parent} by the device types the facts answer for each, without parts that are detached or * crashed, whose device types validation does not read; undefined while none are kept. * * @internal tests only */ listingsOf(parent: Endpoint): ReadonlyMap> | undefined; /** * The parts of {@link parent} whose Base `Duplicate` condition may differ from what their recorded entry read, or * that have none: every part that changed, was forgotten or shares a device type whose number of present parts * passed from one to two or back since its last recording pass, and every part when the listing of {@link parent} * was collected. A part stays a suspect until a pass records it or the owner {@link settled settles} it. */ suspectsOf(parent: Endpoint): ReadonlySet; /** * Stop suspecting {@link part}, whose recorded entry matches it. */ settled(part: Endpoint): void; /** * The reaching endpoints kept for {@link nodeEndpoint} in tree order, undefined while none are kept, as the last * read left them; changes noted since are applied by the next read. The same array while no change applied since * altered what is kept of the scope. * * @internal tests only */ keptOf(nodeEndpoint: Endpoint): readonly Endpoint[] | undefined; /** * The endpoints of the node scope kept for {@link nodeEndpoint} by device type, undefined while none are kept, as * the last read left them. * * @internal tests only */ keptListingOf(nodeEndpoint: Endpoint): ReadonlyMap> | undefined; } export declare namespace NodeScopeIndex { /** * What the recorded judgement of an endpoint read that decides which other endpoints a change to it affects. */ interface Entry { duplicate: boolean; isNodeEndpoint: boolean; /** * The reach of the endpoint's facts, widened by those of descendants destroyed before it. Always * {@link DeviceTypeValidationPass.Reach.None} for a node endpoint, whose node scope is its own subtree. */ reach: DeviceTypeValidationPass.Reach; } } //# sourceMappingURL=NodeScopeIndex.d.ts.map