/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { AddressStatus, ServerAddress } from "./ServerAddress.js"; /** * A set of server addresses ordered by a comparator. */ export interface ServerAddressSet { /** * Add an address. * * If the address alreay exists, returns the existing address to facilitate comparison by value. If not, returns * the input address. */ add(address: T): T; /** * Delete an address. */ delete(address: T): boolean; /** * Replace the stored addresses. */ replace(newAddresses: Iterable): void; /** * Test for existence of address. */ has(address: T): boolean; /** * The number of addresses. */ size: number; /** * Iterate. * * If you replace addresses during iteration only addresses not already produced will be covered by remaining * iterations. */ [Symbol.iterator](): Iterator; } /** * Create a new {@link ServerAddressSet}. */ export declare function ServerAddressSet(initial?: Iterable, comparator?: typeof ServerAddressSet.compareDesirability): ServerAddressSet; export declare namespace ServerAddressSet { interface Comparator { (addr1: T, addr2: T): number; } /** * Update a list of addresses with health information from another list. */ function copyHealth(targetAddresses: Iterable, sourceAddresses: Iterable): T[]; /** * Compare the "desirability" of two addresses for communication. */ function compareDesirability(a: ServerAddress, b: ServerAddress): number; /** * Compare the health of two addresses. * * Returns a negative number if a is healthier, positive if b is healthier and 0 if assessment is neutral. */ function compareHealth(a: AddressStatus, b: AddressStatus): number; } //# sourceMappingURL=ServerAddressSet.d.ts.map