2017-12-04 09:37:39 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2018-03-27 09:51:48 +00:00
|
|
|
"context"
|
2018-03-16 07:46:31 +00:00
|
|
|
"reflect"
|
|
|
|
|
|
|
|
cda "git.loafle.net/commons_go/di/annotation"
|
|
|
|
cdr "git.loafle.net/commons_go/di/registry"
|
2018-03-27 09:51:48 +00:00
|
|
|
oocmci "git.loafle.net/overflow/overflow_commons_go/modules/commons/interfaces"
|
2017-12-04 09:37:39 +00:00
|
|
|
discoveryM "git.loafle.net/overflow/overflow_commons_go/modules/discovery/model"
|
|
|
|
"git.loafle.net/overflow/overflow_discovery/discovery"
|
2018-03-22 16:11:03 +00:00
|
|
|
oopcs "git.loafle.net/overflow/overflow_probe_container/service"
|
2017-12-04 09:37:39 +00:00
|
|
|
)
|
|
|
|
|
2018-03-16 07:46:31 +00:00
|
|
|
func init() {
|
|
|
|
cdr.RegisterType(reflect.TypeOf((*DiscoveryService)(nil)))
|
|
|
|
}
|
|
|
|
|
2017-12-04 09:37:39 +00:00
|
|
|
type DiscoveryService struct {
|
2018-03-16 07:46:31 +00:00
|
|
|
cda.TypeAnnotation `annotation:"@overFlow:Service()"`
|
2018-03-27 09:51:48 +00:00
|
|
|
oocmci.Service
|
2018-03-22 16:11:03 +00:00
|
|
|
|
|
|
|
ProbeService *oopcs.ProbeService `annotation:"@Inject()"`
|
2017-12-04 09:37:39 +00:00
|
|
|
}
|
|
|
|
|
2018-03-27 09:51:48 +00:00
|
|
|
func (ds *DiscoveryService) Start() error {
|
|
|
|
discovery.DiscoveryInit()
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ds *DiscoveryService) Stop(ctx context.Context) error {
|
|
|
|
discovery.DiscoveryDestroy()
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-03-16 06:43:19 +00:00
|
|
|
func (ds *DiscoveryService) DiscoverZone(requesterID string, dz *discoveryM.DiscoveryZone) error {
|
2017-12-04 09:37:39 +00:00
|
|
|
|
2018-03-22 16:11:03 +00:00
|
|
|
discovery.DiscoverZone(ds.ProbeService, requesterID, dz)
|
2017-12-04 09:37:39 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-03-16 06:43:19 +00:00
|
|
|
func (ds *DiscoveryService) DiscoverHost(requesterID string, zone *discoveryM.Zone, dz *discoveryM.DiscoveryHost) error {
|
2017-12-04 09:37:39 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-03-16 06:43:19 +00:00
|
|
|
func (ds *DiscoveryService) DiscoverPort(requesterID string, host *discoveryM.Host, dz *discoveryM.DiscoveryPort) error {
|
2017-12-04 09:37:39 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-03-16 06:43:19 +00:00
|
|
|
func (ds *DiscoveryService) DiscoverService(requesterID string, port *discoveryM.Port, dz *discoveryM.DiscoveryService) error {
|
2017-12-04 09:37:39 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|