import type { ITransportInfo } from '../../../types/public.js'; /** * Interface for the Transport Registry. * Manages the storage and mapping of transports and their assigned Slave IDs. */ export interface ITransportRegistry { has(id: string): boolean; get(id: string): ITransportInfo | undefined; getAll(): ITransportInfo[]; add(info: ITransportInfo): void; remove(id: string): Promise; size(): number; assignSlave(transportId: string, slaveId: number): void; unassignSlave(transportId: string, slaveId: number): void; getSlaveAssignments(slaveId: number): string[]; clearSlaveAssignments(transportId: string): void; } /** * Thread-safe registry for managing Modbus transports. * Maintains a primary map of transports and a secondary map for reverse-lookup of Slave IDs to Transports. */ export declare class TransportRegistry implements ITransportRegistry { private readonly _transports; private readonly _slaveMap; private readonly _mutex; /** * Checks if a transport with the given ID exists in the registry. * @param {string} id - The transport identifier. */ has(id: string): boolean; /** * Retrieves transport information by its ID. * @param {string} id - The transport identifier. */ get(id: string): ITransportInfo | undefined; /** * Returns an array of all registered transports. */ getAll(): ITransportInfo[]; /** * Adds a new transport to the registry. * This operation is thread-safe and will update slave mappings automatically. * * @param {ITransportInfo} info - The transport information object. * @throws {Error} If a transport with the same ID already exists. */ add(info: ITransportInfo): Promise; /** * Removes a transport from the registry and cleans up slave mappings. * @param {string} id - The ID of the transport to remove. * @returns {Promise} The removed transport info, or undefined if not found. */ remove(id: string): Promise; /** * Returns the number of registered transports. */ size(): number; /** * Manually assigns a Slave ID to a specific transport. * @param {string} transportId - Target transport ID. * @param {number} slaveId - The Slave ID to assign. */ assignSlave(transportId: string, slaveId: number): void; /** * Removes a Slave ID assignment from a transport. * @param {string} transportId - Target transport ID. * @param {number} slaveId - The Slave ID to remove. */ unassignSlave(transportId: string, slaveId: number): void; /** * Returns a list of transport IDs assigned to a specific Slave ID. * @param {number} slaveId - The Slave ID to look up. */ getSlaveAssignments(slaveId: number): string[]; /** * Clears all Slave ID assignments for a specific transport in the reverse-lookup map. * @param {string} transportId - The transport ID to clear. */ clearSlaveAssignments(transportId: string): void; /** * Removes all transports and clears all slave mappings. * Used during controller shutdown to fully release resources. */ clearAll(): void; private _addToSlaveMap; private _removeFromSlaveMap; }