2018-04-06 11:02:18 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Observable } from 'rxjs/Observable';
|
2018-05-24 06:44:13 +00:00
|
|
|
import { RPCService } from '@loafer/ng-rpc';
|
2018-04-06 11:02:18 +00:00
|
|
|
import {
|
|
|
|
DiscoveryStartInfo,
|
2018-04-27 16:29:54 +00:00
|
|
|
DiscoverZone as MDDiscoverZone,
|
|
|
|
DiscoverHost as MDDiscoverHost,
|
|
|
|
DiscoverPort as MDDiscoverPort,
|
|
|
|
DiscoverService as MDDiscoverService,
|
2018-04-06 11:02:18 +00:00
|
|
|
Zone,
|
|
|
|
Host,
|
|
|
|
Port,
|
|
|
|
Service,
|
2018-05-02 07:23:35 +00:00
|
|
|
} from '@overflow/commons-typescript/model/discovery';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class DiscoveryService {
|
|
|
|
|
|
|
|
public constructor(
|
|
|
|
private rpcService: RPCService,
|
|
|
|
) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public start(dsInfo: DiscoveryStartInfo): Observable<DiscoveryStartInfo> {
|
|
|
|
|
|
|
|
return this.rpcService.call('DiscoveryService.startDiscovery', dsInfo);
|
|
|
|
}
|
|
|
|
|
2018-04-27 16:29:54 +00:00
|
|
|
public discoverZone(probeID: string, discoverZone: MDDiscoverZone): void {
|
|
|
|
this.rpcService.send('DiscoveryService.discoverZone', probeID, discoverZone);
|
2018-04-06 11:02:18 +00:00
|
|
|
}
|
2018-04-27 16:29:54 +00:00
|
|
|
public discoverHost(probeID: string, zone: Zone, discoverHost: MDDiscoverHost): void {
|
|
|
|
this.rpcService.send('DiscoveryService.discoverHost', probeID, zone, discoverHost);
|
2018-04-06 11:02:18 +00:00
|
|
|
}
|
2018-04-27 16:29:54 +00:00
|
|
|
public discoverPort(probeID: string, host: Host, discoverPort: MDDiscoverPort): void {
|
|
|
|
this.rpcService.send('DiscoveryService.discoverPort', probeID, host, discoverPort);
|
2018-04-06 11:02:18 +00:00
|
|
|
}
|
2018-04-27 16:29:54 +00:00
|
|
|
public discoverService(probeID: string, port: Port, discoverService: MDDiscoverService): void {
|
|
|
|
this.rpcService.send('DiscoveryService.discoverService', probeID, port, discoverService);
|
2018-04-06 11:02:18 +00:00
|
|
|
}
|
|
|
|
}
|