Initialise the command stuff
This commit is contained in:
parent
2753520ee4
commit
8e2dbb8997
@ -5,6 +5,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/cmd"
|
||||
"github.com/micro/go-micro/registry"
|
||||
"github.com/micro/go-micro/selector"
|
||||
)
|
||||
@ -26,6 +27,7 @@ type blackListSelector struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.Selectors["blacklist"] = NewSelector
|
||||
rand.Seed(time.Now().Unix())
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,13 @@
|
||||
package random
|
||||
|
||||
import "github.com/micro/go-micro/selector"
|
||||
import (
|
||||
"github.com/micro/go-micro/cmd"
|
||||
"github.com/micro/go-micro/selector"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd.Selectors["random"] = NewSelector
|
||||
}
|
||||
|
||||
func NewSelector(opts ...selector.Option) selector.Selector {
|
||||
return selector.NewSelector(opts...)
|
||||
|
@ -3,6 +3,7 @@ package roundrobin
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/micro/go-micro/cmd"
|
||||
"github.com/micro/go-micro/registry"
|
||||
"github.com/micro/go-micro/selector"
|
||||
)
|
||||
@ -11,6 +12,10 @@ type roundRobinSelector struct {
|
||||
so selector.Options
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.Selectors["roundrobin"] = NewSelector
|
||||
}
|
||||
|
||||
func (r *roundRobinSelector) Select(service string, opts ...selector.SelectOption) (selector.Next, error) {
|
||||
var sopts selector.SelectOptions
|
||||
for _, opt := range opts {
|
||||
@ -68,7 +73,7 @@ func (r *roundRobinSelector) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewRoundRobinSelector(opts ...selector.Option) selector.Selector {
|
||||
func NewSelector(opts ...selector.Option) selector.Selector {
|
||||
var sopts selector.Options
|
||||
|
||||
for _, opt := range opts {
|
||||
|
Loading…
Reference in New Issue
Block a user