Redefined and polished some interfaces and data structures.

This commit is contained in:
Milos Gajdos
2019-06-07 13:29:09 +01:00
parent ee8b6b3114
commit e4311c3a10
4 changed files with 75 additions and 31 deletions

View File

@@ -1,10 +1,6 @@
// Package router provides an interface for micro network routers
package router
import (
"github.com/micro/go-micro/registry"
)
var (
// DefaultRouter returns default micro router
DefaultRouter = NewRouter()
@@ -25,13 +21,19 @@ type Router interface {
// Lookup queries the routing table and returns matching entries
Lookup(Query) ([]*Entry, error)
// Table returns routing table
Table() *Table
Table() Table
// Address is Router adddress
Address() string
// String implemens fmt.Stringer interface
String() string
}
// RIB is Routing Information Base
type RIB interface {
// String returns debug info
String() string
}
// Option used by the Router
type Option func(*Options)
@@ -43,9 +45,9 @@ type QueryOption func(*QueryOptions)
// NewRouter creates new Router and returns it
func NewRouter(opts ...Option) Router {
// router registry to DefaultRegistry
// set default options
ropts := Options{
Registry: registry.DefaultRegistry,
Table: DefaultTable,
}
for _, o := range opts {