1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-16 02:47:03 +02:00
kratos/transport/http/balancer/balancer.go
2021-06-25 18:18:57 +08:00

22 lines
468 B
Go

package balancer
import (
"context"
"github.com/go-kratos/kratos/v2/registry"
)
// DoneInfo is callback when rpc done
type DoneInfo struct {
Err error
Trailer map[string]string
}
// Balancer is node pick balancer
type Balancer interface {
// Pick one node
Pick(ctx context.Context) (node *registry.ServiceInstance, done func(context.Context, DoneInfo), err error)
// Update nodes when nodes removed or added
Update(nodes []*registry.ServiceInstance)
}