dd0e8eec14
* copyright headers for agent folder * Ignore test data files * fix proto files and remove headers in agent/uiserver folder * ignore deep-copy files
37 lines
995 B
Go
37 lines
995 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package router
|
|
|
|
import (
|
|
"github.com/hashicorp/consul/agent/metadata"
|
|
"github.com/hashicorp/consul/types"
|
|
)
|
|
|
|
// ServerTracker is called when Router is notified of a server being added or
|
|
// removed.
|
|
type ServerTracker interface {
|
|
NewRebalancer(dc string) func()
|
|
AddServer(types.AreaID, *metadata.Server)
|
|
RemoveServer(types.AreaID, *metadata.Server)
|
|
}
|
|
|
|
// Rebalancer is called periodically to re-order the servers so that the load on the
|
|
// servers is evenly balanced.
|
|
type Rebalancer func()
|
|
|
|
// NoOpServerTracker is a ServerTracker that does nothing. Used when gRPC is not
|
|
// enabled.
|
|
type NoOpServerTracker struct{}
|
|
|
|
// Rebalance does nothing
|
|
func (NoOpServerTracker) NewRebalancer(string) func() {
|
|
return func() {}
|
|
}
|
|
|
|
// AddServer does nothing
|
|
func (NoOpServerTracker) AddServer(types.AreaID, *metadata.Server) {}
|
|
|
|
// RemoveServer does nothing
|
|
func (NoOpServerTracker) RemoveServer(types.AreaID, *metadata.Server) {}
|