mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
Full module path rebrand from Temporal to Hanzo Tasks: - go.mod module: github.com/hanzoai/tasks - All internal Go imports updated (1906 files) - cmd/server renamed to cmd/tasksd - Binary name: tasksd (was temporal-server) - Docker images: hanzoai/tasks (was temporalio/server) - README rewritten with Hanzo Tasks branding - LLM.md created with integration notes - Makefile, goreleaser, CI workflows updated - go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos) Fork of Temporal.io (MIT license).
37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
package static
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hanzoai/tasks/common/membership"
|
|
"github.com/hanzoai/tasks/common/primitives"
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
func MembershipModule(
|
|
hostsByService map[primitives.ServiceName]Hosts,
|
|
) fx.Option {
|
|
return fx.Options(
|
|
fx.Provide(func() membership.Monitor {
|
|
return newStaticMonitor(hostsByService)
|
|
}),
|
|
fx.Provide(func(serviceName primitives.ServiceName) membership.HostInfoProvider {
|
|
hosts := hostsByService[serviceName]
|
|
if len(hosts.All) == 0 {
|
|
panic(fmt.Sprintf("hosts for %v service are missing in static hosts", serviceName))
|
|
}
|
|
if len(hosts.Self) == 0 {
|
|
panic(fmt.Sprintf("self host for %v service is missing in static hosts", serviceName))
|
|
}
|
|
|
|
for _, serviceHost := range hosts.All {
|
|
if serviceHost == hosts.Self {
|
|
hostInfo := membership.NewHostInfoFromAddress(serviceHost)
|
|
return membership.NewHostInfoProvider(hostInfo)
|
|
}
|
|
}
|
|
panic(fmt.Sprintf("self host %v for %v service is defined, but missing from the list of all static hosts", hosts.Self, serviceName))
|
|
}),
|
|
)
|
|
}
|