member_webapp/@overflow/discovery/service/discovery.service.ts

41 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2018-04-06 11:02:18 +00:00
import { Injectable } from '@angular/core';
2018-06-04 08:25:29 +00:00
import { Observable } from 'rxjs';
2018-05-31 12:04:52 +00:00
2018-05-31 12:44:11 +00:00
import { RPCService } from '@loafer/ng-rpc';
2018-04-06 11:02:18 +00:00
import {
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,
) {
}
2018-05-31 12:44:11 +00:00
public discoverZone(probeID: string, discoverZone: MDDiscoverZone): void {
2018-04-27 16:29:54 +00:00
this.rpcService.send('DiscoveryService.discoverZone', probeID, discoverZone);
2018-04-06 11:02:18 +00:00
}
2018-05-31 12:44:11 +00:00
public discoverHost(probeID: string, zone: Zone, discoverHost: MDDiscoverHost): void {
2018-04-27 16:29:54 +00:00
this.rpcService.send('DiscoveryService.discoverHost', probeID, zone, discoverHost);
2018-04-06 11:02:18 +00:00
}
2018-05-31 12:44:11 +00:00
public discoverPort(probeID: string, host: Host, discoverPort: MDDiscoverPort): void {
2018-04-27 16:29:54 +00:00
this.rpcService.send('DiscoveryService.discoverPort', probeID, host, discoverPort);
2018-04-06 11:02:18 +00:00
}
2018-05-31 12:44:11 +00:00
public discoverService(probeID: string, port: Port, discoverService: MDDiscoverService): void {
2018-04-27 16:29:54 +00:00
this.rpcService.send('DiscoveryService.discoverService', probeID, port, discoverService);
2018-04-06 11:02:18 +00:00
}
2018-06-04 12:50:46 +00:00
public stopDiscovery(probeID: string): void {
this.rpcService.send('DiscoveryService.stopDiscovery', probeID);
}
2018-04-06 11:02:18 +00:00
}