2024-01-07 09:15:28 +00:00
|
|
|
package node
|
|
|
|
|
2024-01-29 04:59:43 +00:00
|
|
|
import (
|
|
|
|
"git.lumeweb.com/LumeWeb/libs5-go/service"
|
|
|
|
)
|
2024-01-07 09:15:28 +00:00
|
|
|
|
|
|
|
var (
|
2024-01-29 04:59:43 +00:00
|
|
|
_ service.Services = (*ServicesImpl)(nil)
|
2024-01-07 09:15:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ServicesImpl struct {
|
2024-01-29 04:59:43 +00:00
|
|
|
p2p *service.P2PService
|
|
|
|
registry *service.RegistryService
|
|
|
|
http *service.HTTPService
|
2024-01-10 14:19:21 +00:00
|
|
|
}
|
|
|
|
|
2024-01-29 04:59:43 +00:00
|
|
|
func (s *ServicesImpl) HTTP() *service.HTTPService {
|
2024-01-10 14:19:21 +00:00
|
|
|
return s.http
|
2024-01-10 11:21:03 +00:00
|
|
|
}
|
|
|
|
|
2024-01-29 04:59:43 +00:00
|
|
|
func (s *ServicesImpl) All() []service.Service {
|
|
|
|
services := make([]service.Service, 0)
|
2024-01-10 11:33:21 +00:00
|
|
|
services = append(services, s.p2p)
|
|
|
|
services = append(services, s.registry)
|
2024-01-10 14:19:21 +00:00
|
|
|
services = append(services, s.http)
|
2024-01-10 11:33:21 +00:00
|
|
|
|
|
|
|
return services
|
|
|
|
}
|
|
|
|
|
2024-01-29 04:59:43 +00:00
|
|
|
func (s *ServicesImpl) Registry() *service.RegistryService {
|
2024-01-10 11:21:03 +00:00
|
|
|
return s.registry
|
2024-01-07 09:15:28 +00:00
|
|
|
}
|
|
|
|
|
2024-01-29 04:59:43 +00:00
|
|
|
func NewServices(p2p *service.P2PService, registry *service.RegistryService, http *service.HTTPService) service.Services {
|
2024-01-10 11:42:17 +00:00
|
|
|
return &ServicesImpl{
|
|
|
|
p2p: p2p,
|
|
|
|
registry: registry,
|
2024-01-10 14:19:21 +00:00
|
|
|
http: http,
|
2024-01-10 11:42:17 +00:00
|
|
|
}
|
2024-01-07 09:15:28 +00:00
|
|
|
}
|
|
|
|
|
2024-01-29 04:59:43 +00:00
|
|
|
func (s *ServicesImpl) P2P() *service.P2PService {
|
2024-01-07 09:15:28 +00:00
|
|
|
return s.p2p
|
|
|
|
}
|