@ordojs/cli
Version:
Command-line interface for OrdoJS framework
53 lines • 1.65 kB
TypeScript
/**
* @fileoverview OrdoJS CLI - Port Manager
*
* Handles port allocation, detection of conflicts, and finding available ports.
*/
/**
* PortManager class for handling port allocation and conflict resolution
*/
export declare class PortManager {
private usedPorts;
private basePort;
/**
* Create a new PortManager instance
*
* @param basePort - The preferred base port to use (default: 3000)
*/
constructor(basePort?: number);
/**
* Check if a port is available
*
* @param port - The port to check
* @returns Promise resolving to true if the port is available, false otherwise
*/
isPortAvailable(port: number): Promise<boolean>;
/**
* Find an available port starting from the specified port
*
* @param startPort - The port to start checking from
* @returns Promise resolving to an available port number
*/
findAvailablePort(startPort?: number): Promise<number>;
/**
* Allocate a port for a specific service
*
* @param serviceName - Name of the service requesting a port
* @param preferredPort - Preferred port to use if available
* @returns Promise resolving to the allocated port number
*/
allocatePort(serviceName: string, preferredPort?: number): Promise<number>;
/**
* Release a previously allocated port
*
* @param port - The port to release
*/
releasePort(port: number): void;
/**
* Get all currently allocated ports
*
* @returns Set of allocated port numbers
*/
getAllocatedPorts(): Set<number>;
}
//# sourceMappingURL=port-manager.d.ts.map