mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-23 18:25:36 -04:00
31 lines
513 B
Go
31 lines
513 B
Go
package cluster
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type address struct {
|
|
Ip string `json:"ip"`
|
|
Port uint16 `json:"port"`
|
|
Votes []vote `json:"vote"`
|
|
}
|
|
|
|
func (a *address) fullAddress() string {
|
|
return fmt.Sprintf("%s:%d", a.Ip, a.Port)
|
|
}
|
|
|
|
type vote struct {
|
|
NodeID string `json:"node_id"`
|
|
VotedAt int64 `json:"voted_at"`
|
|
Failed bool `json:"failed"`
|
|
}
|
|
|
|
type node struct {
|
|
Addresses []address `json:"ips"`
|
|
LastPingAt int64 `json:"last_ping_at"`
|
|
}
|
|
|
|
type newNodeEvent struct {
|
|
NodeID string `json:"node_id"`
|
|
}
|