@neo-one/server-plugin-network
Version:
NEO•ONE Server network plugin.
62 lines (61 loc) • 2.54 kB
TypeScript
import { Binary, DescribeTable, PortAllocator, TaskList } from '@neo-one/server-plugin';
import { Observable } from 'rxjs';
import { Network, NetworkResourceOptions, NetworkResourceType } from './NetworkResourceType';
import { NodeAdapter } from './node';
import { NetworkType, NodeSettings } from './types';
export interface NodeOptions {
readonly type: NetworkType;
readonly name: string;
readonly dataPath: string;
readonly settings: NodeSettings;
readonly options: NetworkResourceOptions;
}
export interface NetworkResourceAdapterInitOptions {
readonly name: string;
readonly dataPath: string;
readonly binary: Binary;
readonly portAllocator: PortAllocator;
readonly resourceType: NetworkResourceType;
}
export interface NetworkResourceAdapterStaticOptions extends NetworkResourceAdapterInitOptions {
readonly nodesPath: string;
readonly nodesOptionsPath: string;
}
export interface NetworkResourceAdapterOptions extends NetworkResourceAdapterStaticOptions {
readonly type: NetworkType;
readonly nodes: readonly NodeAdapter[];
}
export declare class NetworkResourceAdapter {
static init(options: NetworkResourceAdapterInitOptions): Promise<NetworkResourceAdapter>;
static create(adapterOptions: NetworkResourceAdapterInitOptions, options: NetworkResourceOptions): TaskList;
private static getStaticOptions;
private static getPrivateNetSettings;
private static getMainSettings;
private static getTestSettings;
private static createNodeAdapter;
private static getRPCPort;
private static getListenTCPPort;
private static getTelemetryPort;
private static getPort;
private static writeNodeOptions;
private static readNodeOptions;
private static getNodeOptionsPath;
readonly resource$: Observable<Network>;
private readonly name;
private readonly type;
private readonly dataPath;
private readonly resourceType;
private readonly nodesPath;
private readonly nodesOptionsPath;
private readonly state;
private readonly nodes$;
constructor({ name, type, dataPath, resourceType, nodesPath, nodesOptionsPath, nodes: nodesIn, }: NetworkResourceAdapterOptions);
getDebug(): DescribeTable;
private readonly nodes;
destroy(): Promise<void>;
delete(_options: NetworkResourceOptions): TaskList;
start(_options: NetworkResourceOptions): TaskList;
readonly live: () => Promise<void>;
readonly ready: () => Promise<void>;
stop(_options: NetworkResourceOptions): TaskList;
}