logspout: github.com/gliderlabs/logspout/router Index | Files

package router

import "github.com/gliderlabs/logspout/router"

generated by go-extpoints -- DO NOT EDIT

go:generate go-extpoints . AdapterFactory HttpHandler AdapterTransport LogRouter Job

Index

Package Files

extpoints.go http.go persist.go pump.go routes.go types.go

Variables

var AdapterFactories = &adapterFactoryExt{
    newExtensionPoint(new(AdapterFactory)),
}
var AdapterTransports = &adapterTransportExt{
    newExtensionPoint(new(AdapterTransport)),
}
var HTTPHandlers = &httpHandlerExt{
    newExtensionPoint(new(HTTPHandler)),
}
var Jobs = &jobExt{
    newExtensionPoint(new(Job)),
}
var LogRouters = &logRouterExt{
    newExtensionPoint(new(LogRouter)),
}

func Register Uses

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

func Unregister Uses

func Unregister(name string) []string

type AdapterFactory Uses

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

AdapterFactory is an extension type for adding new log adapters

type AdapterTransport Uses

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 Uses

type HTTPHandler func() http.Handler

HTTPHandler is an extension type for adding HTTP endpoints

type Job Uses

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

Job is a thing to be done

type LogAdapter Uses

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

LogAdapter is a streamed log

type LogRouter Uses

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

LogRouter sends logs to LogAdapters via Routes

type LogsPump Uses

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

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

func (*LogsPump) Name Uses

func (p *LogsPump) Name() string

Name returns the name of the pump

func (*LogsPump) Route Uses

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

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

func (*LogsPump) RoutingFrom Uses

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

RoutingFrom returns whether a container id is routing from this pump

func (*LogsPump) Run Uses

func (p *LogsPump) Run() error

Run executes the pump

func (*LogsPump) Setup Uses

func (p *LogsPump) Setup() error

Setup configures the pump

type Message Uses

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

Message is a log messages

type Route Uses

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 Uses

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

AdapterTransport returns a route's adapter transport string

func (*Route) AdapterType Uses

func (r *Route) AdapterType() string

AdapterType returns a route's adapter type string

func (*Route) Close Uses

func (r *Route) Close()

Close sends true to a Route.closer

func (*Route) Closer Uses

func (r *Route) Closer() <-chan struct{}

Closer returns a route's closerRcv

func (*Route) MatchContainer Uses

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 Uses

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

MatchMessage returns whether the Route is responsible for a given Message

func (*Route) MultiContainer Uses

func (r *Route) MultiContainer() bool

MultiContainer returns whether the Route is matching multiple containers or not

func (*Route) OverrideCloser Uses

func (r *Route) OverrideCloser(closer <-chan struct{})

OverrideCloser sets a Route.closer to closer

type RouteFileStore Uses

type RouteFileStore string

RouteFileStore represents a directory for storing routes

func (RouteFileStore) Add Uses

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

Add writes a marshaled *Route to the RouteFileStore

func (RouteFileStore) Filename Uses

func (fs RouteFileStore) Filename(id string) string

Filename returns the filename in a RouteFileStore for a given id

func (RouteFileStore) Get Uses

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

Get returns *Route based on an id

func (RouteFileStore) GetAll Uses

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

GetAll returns a slice of *Route for the entire RouteFileStore

func (RouteFileStore) Remove Uses

func (fs RouteFileStore) Remove(id string) bool

Remove removes route from the RouteFileStore based on id

type RouteManager Uses

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 Uses

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

Add adds a route to the RouteManager

func (*RouteManager) AddFromURI Uses

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 Uses

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

Get returns a Route based on id

func (*RouteManager) GetAll Uses

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

GetAll returns all routes in the RouteManager

func (*RouteManager) Load Uses

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

Load loads all route from a RouteStore

func (*RouteManager) Name Uses

func (rm *RouteManager) Name() string

Name returns the name of the RouteManager

func (*RouteManager) Remove Uses

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

Remove removes a route from a RouteManager based on id

func (*RouteManager) Route Uses

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 Uses

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

RoutingFrom returns whether a given container is routing through the RouteManager

func (*RouteManager) Run Uses

func (rm *RouteManager) Run() error

Run executes the RouteManager

func (*RouteManager) Setup Uses

func (rm *RouteManager) Setup() error

Setup configures the RouteManager

type RouteStore Uses

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

Package router imports 21 packages (graph) and is imported by 203 packages. Updated 2020-05-27. Refresh now. Tools for package owners.