Files
tasks/common/membership/static/monitor.go
zeekay 5a601d081b rebrand: go.temporal.io/server -> github.com/hanzoai/tasks
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).
2026-03-19 10:36:40 -07:00

78 lines
1.7 KiB
Go

package static
import (
"context"
"time"
"github.com/hanzoai/tasks/common/membership"
"github.com/hanzoai/tasks/common/primitives"
)
type (
staticMonitor struct {
hosts map[primitives.ServiceName]Hosts
resolvers map[primitives.ServiceName]*staticResolver
}
Hosts struct {
// Addresses of all hosts per service.
All []string
// Address of this host. May be empty if this host is not running this service.
Self string
}
)
func SingleLocalHost(host string) Hosts {
return Hosts{All: []string{host}, Self: host}
}
func newStaticMonitor(hosts map[primitives.ServiceName]Hosts) membership.Monitor {
resolvers := make(map[primitives.ServiceName]*staticResolver, len(hosts))
for service, hostList := range hosts {
resolvers[service] = newStaticResolver(hostList.All)
}
return &staticMonitor{
hosts: hosts,
resolvers: resolvers,
}
}
func (s *staticMonitor) Start() {
for service, r := range s.resolvers {
r.start(s.hosts[service].All)
}
}
func (s *staticMonitor) EvictSelf() error {
return nil
}
func (s *staticMonitor) EvictSelfAt(asOf time.Time) (time.Duration, error) {
return 0, nil
}
func (s *staticMonitor) GetResolver(service primitives.ServiceName) (membership.ServiceResolver, error) {
resolver, ok := s.resolvers[service]
if !ok {
return nil, membership.ErrUnknownService
}
return resolver, nil
}
func (s *staticMonitor) GetReachableMembers() ([]string, error) {
return nil, nil
}
func (s *staticMonitor) WaitUntilInitialized(_ context.Context) error {
return nil
}
func (s *staticMonitor) SetDraining(draining bool) error {
return nil
}
func (s *staticMonitor) ApproximateMaxPropagationTime() time.Duration {
return 0
}