/// import { IdentityService } from "./app/service/IdentityService"; import { MembershipService } from "./app/service/MembershipService"; import { PeeringService } from "./app/service/PeeringService"; import { BlockchainService } from "./app/service/BlockchainService"; import { TransactionService } from "./app/service/TransactionsService"; import { ConfDTO } from "./app/lib/dto/ConfDTO"; import { FileDAL } from "./app/lib/dal/fileDAL"; import * as stream from "stream"; import { GlobalFifoPromise } from "./app/service/GlobalFifoPromise"; import { BlockchainContext } from "./app/lib/computation/BlockchainContext"; import { BlockDTO } from "./app/lib/dto/BlockDTO"; import { DBIdentity } from "./app/lib/dal/sqliteDAL/IdentityDAL"; import { CertificationDTO } from "./app/lib/dto/CertificationDTO"; import { MembershipDTO } from "./app/lib/dto/MembershipDTO"; import { RevocationDTO } from "./app/lib/dto/RevocationDTO"; import { TransactionDTO } from "./app/lib/dto/TransactionDTO"; import { PeerDTO } from "./app/lib/dto/PeerDTO"; import { WS2PCluster } from "./app/modules/ws2p/lib/WS2PCluster"; import { DBBlock } from "./app/lib/db/DBBlock"; import { DBPeer } from "./app/lib/db/DBPeer"; import { HttpMilestonePage } from "./app/modules/bma/lib/dtos"; export interface HookableServer { generatorGetJoinData: (...args: any[]) => Promise; generatorComputeNewCerts: (...args: any[]) => Promise; generatorNewCertsToLinks: (...args: any[]) => Promise; onPluggedFSHook: (...args: any[]) => Promise; resetDataHook: (...args: any[]) => Promise; resetConfigHook: (...args: any[]) => Promise; } export declare class Server extends stream.Duplex implements HookableServer { private memoryOnly; private overrideConf; private paramsP; private endpointsDefinitions; private wrongEndpointsFilters; startService: () => Promise; stopService: () => Promise; ws2pCluster: WS2PCluster | undefined; conf: ConfDTO; dal: FileDAL; home: string; version: string; logger: any; rawer: any; keyPair: any; sign: any; blockchain: any; MerkleService: (req: any, merkle: any, valueCoroutine: any) => any; IdentityService: IdentityService; MembershipService: MembershipService; PeeringService: PeeringService; BlockchainService: BlockchainService; TransactionsService: TransactionService; private documentFIFO; milestoneArray: DBBlock[]; constructor(home: string, memoryOnly: boolean, overrideConf: any); getDocumentsFIFO(): GlobalFifoPromise; _read(): void; _write(obj: any, enc: any, writeDone: any): Promise; /** * Facade method to control what is pushed to the stream (we don't want it to be closed) * @param obj An object to be pushed to the stream. */ streamPush(obj: any): void; getBcContext(): BlockchainContext; plugFileSystem(): Promise; unplugFileSystem(): Promise; reloadConf(): Promise; loadConf(useDefaultConf?: any, reuseExisting?: boolean): Promise; initWithDAL(): Promise; writeRawBlock(raw: string): Promise; writeBlock(obj: any, notify?: boolean, noResolution?: boolean): Promise; writeRawIdentity(raw: string): Promise; writeIdentity(obj: any, notify?: boolean): Promise; writeRawCertification(raw: string): Promise; writeCertification(obj: any, notify?: boolean): Promise; writeRawMembership(raw: string): Promise; writeMembership(obj: any, notify?: boolean): Promise; writeRawRevocation(raw: string): Promise; writeRevocation(obj: any, notify?: boolean): Promise; writeRawTransaction(raw: string): Promise; writeTransaction(obj: any, notify?: boolean): Promise; writeRawPeer(raw: string): Promise; writePeer(obj: any, notify?: boolean): Promise; private emitDocument; initDAL(conf?: ConfDTO | null): Promise; recomputeSelfPeer(): Promise; getCountOfSelfMadePoW(): Promise; checkConfig(): Promise; resetHome(): Promise; resetAll(done?: any): Promise; resetData(done?: any): Promise; resetConf(done?: any): Promise; resetStats(done?: any): Promise; resetPeers(): Promise; exportAllDataAsZIP(): Promise; importAllDataFromZIP(zipFile: string): Promise; private resetFiles; disconnect(): Promise; revert(): Promise; revertHead(): Promise; revertTo(number: number): Promise; pullingEvent(type: string, number?: any): void; reapplyTo(number: number): Promise; /***************** * DAEMONIZATION ****************/ /** * Get the daemon handle. Eventually give arguments to launch a new daemon. * @param overrideCommand The new command to launch. * @param insteadOfCmd The current command to be replaced by `overrideCommand` command. * @returns {*} The daemon handle. */ getDaemon(overrideCommand?: string, insteadOfCmd?: string): any; /** * Return current script full command arguments except the two firsts (which are node executable + js file). * If the two optional `cmd` and `insteadOfCmd` parameters are given, replace `insteadOfCmd`'s value by `cmd` in * the script arguments. * * Ex: * * process.argv: ['/usr/bin/node', '/opt/duniter/sources/bin/duniter', 'restart', '--mdb', 'g1'] * * Then `getCommand('direct_start', 'restart') will return: * * * ['direct_start', '--mdb', 'g1'] * * This new array is what will be given to a *fork* of current script, resulting in a new process with: * * * process.argv: ['/usr/bin/node', '/opt/duniter/sources/bin/duniter', 'direct_start', '--mdb', 'g1'] * * @param cmd * @param insteadOfCmd * @returns {*} */ private getCommand; /** * Retrieve the last linesQuantity lines from the log file. * @param linesQuantity */ getLastLogLines(linesQuantity: number): Promise; addEndpointsDefinitions(definition: () => Promise): void; addWrongEndpointFilter(filter: (endpoints: string[]) => Promise): void; getEndpoints(): Promise; getWrongEndpoints(endpoints: string[]): Promise; /***************** * MODULES UTILITIES ****************/ requireFile(path: string): any; /***************** * MODULES PLUGS ****************/ /** * Default WoT incoming data for new block. To be overriden by a module. */ generatorGetJoinData(current: DBBlock | null, idtyHash: string, char: string): Promise; /** * Default WoT incoming certifications for new block, filtering wrong certs. To be overriden by a module. */ generatorComputeNewCerts(...args: any[]): Promise; /** * Default WoT transforming method for certs => links. To be overriden by a module. */ generatorNewCertsToLinks(...args: any[]): Promise; /** * Default hook on file system plugging. To be overriden by module system. */ onPluggedFSHook(): Promise; /** * Default hook on data reset. To be overriden by module system. */ resetDataHook(): Promise; /** * Default hook on data reset. To be overriden by module system. */ resetConfigHook(): Promise; milestones(page?: number): Promise; }