package service import ( "reflect" cda "git.loafle.net/commons_go/di/annotation" cdr "git.loafle.net/commons_go/di/registry" discoveryM "git.loafle.net/overflow/overflow_commons_go/modules/discovery/model" oocmp "git.loafle.net/overflow/overflow_commons_go/modules/probe" oocmpsp "git.loafle.net/overflow/overflow_commons_go/modules/probe/service/probe" ) func init() { cdr.RegisterType(reflect.TypeOf((*DiscoveryService)(nil)), &cda.ComponentAnnotation{}) } type DiscoveryService struct { ContainerService *ContainerService `annotation:"@Inject()"` CentralService *CentralService `annotation:"@Inject()"` } func (ds *DiscoveryService) DiscoverZone(dz *discoveryM.DiscoveryZone) error { return ds.ContainerService.Send(oocmpsp.ProbeContainerNameDiscovery, "DiscoveryService.DiscoverZone", dz) } func (ds *DiscoveryService) DiscoverHost(zone *discoveryM.Zone, dh *discoveryM.DiscoveryHost) error { return ds.ContainerService.Send(oocmpsp.ProbeContainerNameDiscovery, "DiscoveryService.DiscoverHost", zone, dh) } func (ds *DiscoveryService) DiscoverPort(host *discoveryM.Host, dp *discoveryM.DiscoveryPort) error { return ds.ContainerService.Send(oocmpsp.ProbeContainerNameDiscovery, "DiscoveryService.DiscoverPort", host, dp) } func (ds *DiscoveryService) DiscoverService(port *discoveryM.Port, dService *discoveryM.DiscoveryService) error { return ds.ContainerService.Send(oocmpsp.ProbeContainerNameDiscovery, "DiscoveryService.DiscoverZone", port, dService) } // use by discovery func (ds *DiscoveryService) DiscoveredZone(zone *discoveryM.Zone) error { return ds.CentralService.Send(oocmp.HTTPEntry_Probe, "DiscoveryService.DiscoveredZone", zone) } func (ds *DiscoveryService) DiscoveredHost(host *discoveryM.Host) error { return ds.CentralService.Send(oocmp.HTTPEntry_Probe, "DiscoveryService.DiscoveredHost", host) } func (ds *DiscoveryService) DiscoveredPort(port *discoveryM.Port) error { return ds.CentralService.Send(oocmp.HTTPEntry_Probe, "DiscoveryService.DiscoveredPort", port) } func (ds *DiscoveryService) DiscoveredService(service *discoveryM.Service) error { return ds.CentralService.Send(oocmp.HTTPEntry_Probe, "DiscoveryService.DiscoveredService", service) }