Documentation ¶
Overview ¶
Package router provides interfaces that need to be satisfied in order to implement a new router on tsuru.
Index ¶
- Variables
- func BuildHealthCheck(routerName string) func() error
- func IsSwapped(name string) (bool, string, error)
- func Register(name string, r routerFactory)
- func Remove(appName string) error
- func Retrieve(appName string) (string, error)
- func Store(appName, routerName, kind string) error
- func Swap(r Router, backend1, backend2 string) error
- func ValidCName(cname, domain string) bool
- type HealthChecker
- type MessageRouter
- type PlanRouter
- type Router
- type RouterError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBackendExists = errors.New("Backend already exists") ErrBackendNotFound = errors.New("Backend not found") ErrBackendSwapped = errors.New("Backend is swapped cannot remove") ErrRouteExists = errors.New("Route already exists") ErrRouteNotFound = errors.New("Route not found") ErrCNameExists = errors.New("CName already exists") ErrCNameNotFound = errors.New("CName not found") ErrCNameNotAllowed = errors.New("CName as router subdomain not allowed") )
Functions ¶
func BuildHealthCheck ¶
BuildHealthCheck creates a healthcheck function for the given routerName.
It will call the HealthCheck() method in the router (only if it's also a HealthChecker), for each instance of it (including the "main" instance and all custom routers).
func ValidCName ¶
validCName returns true if the cname is not a subdomain of the router current domain, false otherwise.
Types ¶
type HealthChecker ¶
type HealthChecker interface {
HealthCheck() error
}
type MessageRouter ¶
type PlanRouter ¶
func List ¶
func List() ([]PlanRouter, error)
type Router ¶
type Router interface { AddBackend(name string) error RemoveBackend(name string) error AddRoute(name string, address *url.URL) error RemoveRoute(name string, address *url.URL) error SetCName(cname, name string) error UnsetCName(cname, name string) error Addr(name string) (string, error) // Swap change the router between two backends. Swap(string, string) error // Routes returns a list of routes of a backend. Routes(name string) ([]*url.URL, error) }
Router is the basic interface of this package. It provides methods for managing backends and routes. Each backend can have multiple routes.
type RouterError ¶
func (*RouterError) Error ¶
func (e *RouterError) Error() string
Directories ¶
Path | Synopsis |
---|---|
Package hipache provides a router implementation that store routes in Redis, as specified by Hipache (https://github.com/dotcloud/hipache).
|
Package hipache provides a router implementation that store routes in Redis, as specified by Hipache (https://github.com/dotcloud/hipache). |
Click to show internal directories.
Click to hide internal directories.