v3 refactor (#1868)
* Move to v3 Co-authored-by: Ben Toogood <bentoogood@gmail.com>
This commit is contained in:
@@ -4,7 +4,8 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/micro/go-micro/v2/registry"
|
||||
"github.com/micro/go-micro/v3/registry"
|
||||
"github.com/micro/go-micro/v3/registry/mdns"
|
||||
)
|
||||
|
||||
// Options are router options
|
||||
@@ -23,8 +24,8 @@ type Options struct {
|
||||
Advertise Strategy
|
||||
// Context for additional options
|
||||
Context context.Context
|
||||
// Prewarm the route table on router startup
|
||||
Prewarm bool
|
||||
// Precache the route table on router startup
|
||||
Precache bool
|
||||
}
|
||||
|
||||
// Id sets Router Id
|
||||
@@ -69,10 +70,10 @@ func Advertise(a Strategy) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Prewarm sets whether to prewarm the route table
|
||||
func Prewarm(b bool) Option {
|
||||
// Precache sets whether to precache the route table
|
||||
func Precache(b bool) Option {
|
||||
return func(o *Options) {
|
||||
o.Prewarm = b
|
||||
o.Precache = b
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ func DefaultOptions() Options {
|
||||
Id: uuid.New().String(),
|
||||
Address: DefaultAddress,
|
||||
Network: DefaultNetwork,
|
||||
Registry: registry.DefaultRegistry,
|
||||
Registry: mdns.NewRegistry(),
|
||||
Advertise: AdvertiseLocal,
|
||||
Context: context.Background(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user