2024-01-29 07:16:14 +00:00
|
|
|
package fx
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.lumeweb.com/LumeWeb/libs5-go/node"
|
|
|
|
"git.lumeweb.com/LumeWeb/libs5-go/service"
|
2024-01-30 02:32:13 +00:00
|
|
|
_default "git.lumeweb.com/LumeWeb/libs5-go/service/default"
|
2024-01-29 07:16:14 +00:00
|
|
|
"go.uber.org/fx"
|
|
|
|
)
|
|
|
|
|
|
|
|
var Module = fx.Module("libs5",
|
|
|
|
fx.Provide(newP2P),
|
|
|
|
fx.Provide(newRegistry),
|
|
|
|
fx.Provide(newHTTP),
|
|
|
|
fx.Provide(newStorage),
|
|
|
|
fx.Provide(newServices),
|
|
|
|
fx.Provide(node.NewNode),
|
|
|
|
)
|
|
|
|
|
|
|
|
type ServiceParams struct {
|
|
|
|
fx.In
|
|
|
|
service.ServiceParams
|
|
|
|
}
|
|
|
|
|
|
|
|
type ServicesParams struct {
|
|
|
|
fx.In
|
|
|
|
node.ServicesParams
|
|
|
|
}
|
|
|
|
|
2024-01-30 02:32:13 +00:00
|
|
|
func newP2P(params ServiceParams) service.P2PService {
|
|
|
|
return _default.NewP2P(params.ServiceParams)
|
2024-01-29 07:16:14 +00:00
|
|
|
}
|
|
|
|
|
2024-01-30 02:32:13 +00:00
|
|
|
func newRegistry(params ServiceParams) service.RegistryService {
|
|
|
|
return _default.NewRegistry(params.ServiceParams)
|
2024-01-29 07:16:14 +00:00
|
|
|
}
|
2024-01-30 02:32:13 +00:00
|
|
|
func newHTTP(params ServiceParams) service.HTTPService {
|
|
|
|
return _default.NewHTTP(params.ServiceParams)
|
2024-01-29 07:16:14 +00:00
|
|
|
}
|
|
|
|
|
2024-01-30 02:32:13 +00:00
|
|
|
func newStorage(params ServiceParams) service.StorageService {
|
|
|
|
return _default.NewStorage(params.ServiceParams)
|
2024-01-29 07:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func newServices(params ServicesParams) service.Services {
|
|
|
|
return node.NewServices(params.ServicesParams)
|
|
|
|
}
|