First commit: Outline of Router interface

This commit is contained in:
Milos Gajdos
2019-06-06 16:37:40 +01:00
parent 6587ae07be
commit 08da7c1283
5 changed files with 152 additions and 0 deletions

31
router/options.go Normal file
View File

@@ -0,0 +1,31 @@
package router
import (
"context"
"time"
"github.com/micro/go-micro/registry"
)
// Options allows to set Router options
type Options struct {
// Registry is route source registry i.e. local registry
Registry registry.Registry
// Context stores arbitrary options
Context context.Context
}
// RouteOption allows to soecify routing table options
type RouteOption struct {
// TTL defines route entry lifetime
TTL time.Duration
// COntext allows to specify other arbitrary options
Context context.Context
}
// Registry is local registry
func Registry(r registry.Registry) Option {
return func(o *Options) {
o.Registry = r
}
}