/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { Endpoint } from "#endpoint/Endpoint.js"; import type { StorageContext } from "@matter/general"; import { ServerEndpointStore } from "./ServerEndpointStore.js"; /** * Manages {@link ServerEndpointStore}s for a {@link ServerNode} and owns the node's endpoint numbers. * * Each number is reserved for one store. An installed endpoint keeps its number. A reservation of an * endpoint that is not installed goes to another endpoint that presets the number; the original endpoint gets a new * number when it returns. */ export declare class ServerEndpointStores { #private; load(storage: StorageContext): Promise; erase(): Promise; close(): Promise; /** * Reserve the preset number of a {@link Endpoint} or allocate one. * * A preset number held by an endpoint that is not installed is taken over; that endpoint gets a new number when it * returns. An installed holder is refused before this runs, by the node's index. A new number is the next free one * after the last assigned, wrapping to 1 after 0xFFFE, and skips the preset numbers in * {@link AssignNumberContext.presetNumbers}. * * We must persist the assigned number and next endpoint number. We are fairly resilient to the small chance that * persistence fails so we persist lazily and return synchronously. * * @see {@link MatterSpecification.v161.Core} ยง 9.2.10 */ assignNumber(endpoint: Endpoint, context: AssignNumberContext): void; /** * Obtain the store for a single {@link Endpoint}. * * These stores are cached internally by ID. */ storeForEndpoint(endpoint: Endpoint): ServerEndpointStore; /** * Erase storage for a single {@link Endpoint} and release the numbers its stores hold. */ eraseStoreForEndpoint(endpoint: Endpoint): Promise; } /** * What {@link ServerEndpointStores.assignNumber} needs to know about the node. * * @internal */ export interface AssignNumberContext { /** * Preset numbers of endpoints of the node that are not installed, which a new number must not take. Called only * when a new number is allocated. */ presetNumbers(): ReadonlySet; /** * Does an installed endpoint of the node hold {@link number}? */ isInstalled(number: number): boolean; } //# sourceMappingURL=ServerEndpointStores.d.ts.map