go-platform: github.com/micro/go-platform/router Index | Files | Directories

package router

import "github.com/micro/go-platform/router"

Package router is an interface for global service routing.

Index

Package Files

cache.go context.go marshalling.go options.go os.go router.go stats.go wrapper.go

Variables

var (
    StatsTopic  = "micro.router.stats"
    LabelPrefix = "X-Micro-Label-"
)

func Client Uses

func Client(c client.Client) selector.Option

func NewContext Uses

func NewContext(ctx context.Context, c Router) context.Context

func NewLabelWrapper Uses

func NewLabelWrapper(c client.Client) client.Client

func Server Uses

func Server(s server.Server) selector.Option

type Request Uses

type Request interface {
    Service() string
    Method() string
}

Could be client or server request

type Router Uses

type Router interface {
    // Provides the selector interface
    selector.Selector
    // Return stats maintained here
    Stats() ([]*Stats, error)
    // Record stats for a request - too many args ugh
    Record(r Request, node *registry.Node, d time.Duration, err error)
}

The router is the client interface to a global service loadbalancer (GSLB). Metrics are batched and published to a router which has a view of the whole system.

func FromContext Uses

func FromContext(ctx context.Context) (Router, bool)

func NewRouter Uses

func NewRouter(opts ...selector.Option) Router

type Stats Uses

type Stats struct {
    Service   *registry.Service
    Client    *registry.Service
    Timestamp int64
    Duration  int64
}

Directories

PathSynopsis
protoPackage go_micro_os_router is a generated protocol buffer package.

Package router imports 14 packages (graph) and is imported by 3 packages. Updated 2018-04-17. Refresh now. Tools for package owners.