added netbox allocator
This commit is contained in:
parent
fef86deac8
commit
cef74df3e8
10 changed files with 195 additions and 53 deletions
|
|
@ -48,11 +48,11 @@ func (c *Cluster) Start(raftcfg *config.Config) error {
|
|||
transport = raft.NewNetworkTransportWithLogger(s, pool, timeout, hcl)
|
||||
} else {
|
||||
log.V(1).Info("setup", "transport", "tcp")
|
||||
address, err := net.ResolveTCPAddr("tcp", cfg.Address)
|
||||
address, err := net.ResolveTCPAddr("tcp", cfg.Listen)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
transport, err = raft.NewTCPTransportWithLogger(cfg.Address, address, pool, timeout, hcl)
|
||||
transport, err = raft.NewTCPTransportWithLogger(cfg.Listen, address, pool, timeout, hcl)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -85,10 +85,10 @@ func (c *Cluster) Start(raftcfg *config.Config) error {
|
|||
// Add Local Peer
|
||||
configuration.Servers = append(configuration.Servers, raft.Server{
|
||||
ID: raft.ServerID(cfg.ID),
|
||||
Address: raft.ServerAddress(cfg.Address),
|
||||
Address: raft.ServerAddress(cfg.Listen),
|
||||
})
|
||||
for _, p := range cfg.Peers {
|
||||
if cfg.Address != p.Address {
|
||||
if cfg.Listen != p.Address {
|
||||
configuration.Servers = append(configuration.Servers, raft.Server{
|
||||
ID: raft.ServerID(p.ID),
|
||||
Address: raft.ServerAddress(p.Address)})
|
||||
|
|
@ -113,7 +113,7 @@ func (c *Cluster) Start(raftcfg *config.Config) error {
|
|||
leading := false
|
||||
following := false
|
||||
for {
|
||||
if !leading && cfg.Address == string(c.r.Leader()) {
|
||||
if !leading && cfg.Listen == string(c.r.Leader()) {
|
||||
leading = true
|
||||
go c.leader(ctx)
|
||||
} else if !following && !leading {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue