@neo-one/server
Version:
NEO•ONE Server that NEO•ONE CLI and other clients connect to.
56 lines (55 loc) • 1.75 kB
TypeScript
import { Monitor } from '@neo-one/monitor';
import { Config, DescribeTable, PortAllocator as IPortAllocator } from '@neo-one/server-plugin';
interface NamePorts {
[name: string]: number;
}
interface ResourcePorts {
[resource: string]: NamePorts;
}
interface PluginPorts {
[resourceType: string]: ResourcePorts;
}
interface Ports {
[plugin: string]: PluginPorts;
}
interface PortAllocatorConfig {
readonly ports: Ports;
}
export declare class PortAllocator implements IPortAllocator {
static create({ monitor, dataPath, portMin, portMax, }: {
readonly monitor: Monitor;
readonly dataPath: string;
readonly portMin: number;
readonly portMax: number;
}): Promise<PortAllocator>;
private readonly monitor;
private readonly mutablePorts;
private mutableCurrentPort;
private readonly mutableAvailablePorts;
private readonly config;
private mutablePersisting;
private mutableShouldPersist;
constructor({ monitor, ports, portMin, portMax, config, }: {
readonly monitor: Monitor;
readonly ports: Ports;
readonly portMin: number;
readonly portMax: number;
readonly config: Config<PortAllocatorConfig>;
});
releasePort({ plugin, resourceType, resource, name, }: {
readonly plugin: string;
readonly resourceType: string;
readonly resource: string;
readonly name?: string;
}): void;
allocatePort({ plugin, resourceType, resource, name, }: {
readonly plugin: string;
readonly resourceType: string;
readonly resource: string;
readonly name: string;
}): number;
getDebug(): DescribeTable;
private persist;
private getNextPort;
}
export {};