You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
415 B
24 lines
415 B
package balancer
|
|
|
|
import (
|
|
cmap "github.com/orcaman/concurrent-map/v2"
|
|
)
|
|
|
|
type Balancer struct {
|
|
Brokers cmap.ConcurrentMap[string, *BrokerStats]
|
|
}
|
|
type BrokerStats struct {
|
|
TopicPartitionCount int32
|
|
ConsumerCount int32
|
|
CpuUsagePercent int32
|
|
}
|
|
|
|
func NewBalancer() *Balancer {
|
|
return &Balancer{
|
|
Brokers: cmap.New[*BrokerStats](),
|
|
}
|
|
}
|
|
|
|
func NewBrokerStats() *BrokerStats {
|
|
return &BrokerStats{}
|
|
}
|