mirror of
https://github.com/go-kratos/kratos.git
synced 2026-05-16 09:48:28 +02:00
28abad2268
* add http resolver & balancer Co-authored-by: chenzhihui <zhihui_chen@foxmail.com>
19 lines
400 B
Go
19 lines
400 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(ctx context.Context, pathPattern string, nodes []*registry.ServiceInstance) (node *registry.ServiceInstance, done func(DoneInfo), err error)
|
|
}
|