router

package
Version: v3.2.5+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

generated by go-extpoints -- DO NOT EDIT

Index

Constants

This section is empty.

Variables

View Source
var AdapterFactories = &adapterFactoryExt{
	newExtensionPoint(new(AdapterFactory)),
}
View Source
var AdapterTransports = &adapterTransportExt{
	newExtensionPoint(new(AdapterTransport)),
}
View Source
var HttpHandlers = &httpHandlerExt{
	newExtensionPoint(new(HttpHandler)),
}
View Source
var Jobs = &jobExt{
	newExtensionPoint(new(Job)),
}
View Source
var LogRouters = &logRouterExt{
	newExtensionPoint(new(LogRouter)),
}

Functions

func Register

func Register(component interface{}, name string) []string

func Unregister

func Unregister(name string) []string

Types

type AdapterFactory

type AdapterFactory func(route *Route) (LogAdapter, error)

AdapterFactory is an extension type for adding new log adapters

type AdapterTransport

type AdapterTransport interface {
	Dial(addr string, options map[string]string) (net.Conn, error)
}

AdapterTransport is an extension type for connection transports used by adapters

type HttpHandler

type HttpHandler func() http.Handler

HttpHandler is an extension type for adding HTTP endpoints

type Job

type Job interface {
	Run() error
	Setup() error
	Name() string
}

Job is a thing to be done

type LogAdapter

type LogAdapter interface {
	Stream(logstream chan *Message)
}

LogAdapter is a streamed log

type LogRouter

type LogRouter interface {
	RoutingFrom(containerID string) bool
	Route(route *Route, logstream chan *Message)
}

LogRouter sends logs to LogAdapters via Routes

type LogsPump

type LogsPump struct {
	// contains filtered or unexported fields
}

LogsPump is responsible for "pumping" logs to their configured destinations

func (*LogsPump) Name

func (p *LogsPump) Name() string

Name returns the name of the pump

func (*LogsPump) Route

func (p *LogsPump) Route(route *Route, logstream chan *Message)

Route takes a logstream and routes it according to the supplied Route

func (*LogsPump) RoutingFrom

func (p *LogsPump) RoutingFrom(id string) bool

RoutingFrom returns whether a container id is routing from this pump

func (*LogsPump) Run

func (p *LogsPump) Run() error

Run executes the pump

func (*LogsPump) Setup

func (p *LogsPump) Setup() error

Setup configures the pump

type Message

type Message struct {
	Container *docker.Container
	Source    string
	Data      string
	Time      time.Time
}

Message is a log messages

type Route

type Route struct {
	ID            string            `json:"id"`
	FilterID      string            `json:"filter_id,omitempty"`
	FilterName    string            `json:"filter_name,omitempty"`
	FilterSources []string          `json:"filter_sources,omitempty"`
	FilterLabels  []string          `json:"filter_labels,omitempty"`
	Adapter       string            `json:"adapter"`
	Address       string            `json:"address"`
	Options       map[string]string `json:"options,omitempty"`
	// contains filtered or unexported fields
}

Route represents what subset of logs should go where

func (*Route) AdapterTransport

func (r *Route) AdapterTransport(dfault string) string

AdapterTransport returns a route's adapter transport string

func (*Route) AdapterType

func (r *Route) AdapterType() string

AdapterType returns a route's adapter type string

func (*Route) Close

func (r *Route) Close()

Close sends true to a Route.closer

func (*Route) Closer

func (r *Route) Closer() <-chan bool

Closer returns a route's closerRcv

func (*Route) MatchContainer

func (r *Route) MatchContainer(id, name string, labels map[string]string) bool

MatchContainer returns whether the Route is responsible for a given container

func (*Route) MatchMessage

func (r *Route) MatchMessage(message *Message) bool

MatchMessage returns whether the Route is responsible for a given Message

func (*Route) MultiContainer

func (r *Route) MultiContainer() bool

MultiContainer returns whether the Route is matching multiple containers or not

func (*Route) OverrideCloser

func (r *Route) OverrideCloser(closer <-chan bool)

OverrideCloser sets a Route.closer to closer

type RouteFileStore

type RouteFileStore string

RouteFileStore represents a directory for storing routes

func (RouteFileStore) Add

func (fs RouteFileStore) Add(route *Route) error

Add writes a marshalled *Route to the RouteFileStore

func (RouteFileStore) Filename

func (fs RouteFileStore) Filename(id string) string

Filename returns the filename in a RouteFileStore for a given id

func (RouteFileStore) Get

func (fs RouteFileStore) Get(id string) (*Route, error)

Get returns *Route based on an id

func (RouteFileStore) GetAll

func (fs RouteFileStore) GetAll() ([]*Route, error)

GetAll returns a slice of *Route for the entire RouteFileStore

func (RouteFileStore) Remove

func (fs RouteFileStore) Remove(id string) bool

Remove removes route from the RouteFileStore based on id

type RouteManager

type RouteManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

RouteManager is responsible for maintaining route state

var Routes *RouteManager

Routes is all the configured routes

func (*RouteManager) Add

func (rm *RouteManager) Add(route *Route) error

Add adds a route to the RouteManager

func (*RouteManager) AddFromURI

func (rm *RouteManager) AddFromURI(uri string) error

AddFromURI creates a new route from an URI string and adds it to the RouteManager

func (*RouteManager) Get

func (rm *RouteManager) Get(id string) (*Route, error)

Get returns a Route based on id

func (*RouteManager) GetAll

func (rm *RouteManager) GetAll() ([]*Route, error)

GetAll returns all routes in the RouteManager

func (*RouteManager) Load

func (rm *RouteManager) Load(persistor RouteStore) error

Load loads all route from a RouteStore

func (*RouteManager) Name

func (rm *RouteManager) Name() string

Name returns the name of the RouteManager

func (*RouteManager) Remove

func (rm *RouteManager) Remove(id string) bool

Remove removes a route from a RouteManager based on id

func (*RouteManager) Route

func (rm *RouteManager) Route(route *Route, logstream chan *Message)

Route takes a logstream and route and passes them off to all configure LogRouters

func (*RouteManager) RoutingFrom

func (rm *RouteManager) RoutingFrom(containerID string) bool

RoutingFrom returns whether a given container is routing through the RouteManager

func (*RouteManager) Run

func (rm *RouteManager) Run() error

Run executes the RouteManager

func (*RouteManager) Setup

func (rm *RouteManager) Setup() error

Setup configures the RouteManager

type RouteStore

type RouteStore interface {
	Get(id string) (*Route, error)
	GetAll() ([]*Route, error)
	Add(route *Route) error
	Remove(id string) bool
}

RouteStore is a collections of Routes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL