Documentation ¶
Overview ¶
Package app contains the main Application struct. This struct represents the application and is resposible for creating and connecting all other parts of the software.
Index ¶
- func CleanupEnv(cfg *config.Config) error
- func SetupEnv(cfg *config.Config) error
- type Application
- func (app *Application) GetLocationFor(host, path string) *types.Location
- func (a *Application) GetUpstream(id string) types.Upstream
- func (a *Application) Reload(cfg *config.Config) error
- func (a *Application) Run() error
- func (app *Application) ServeHTTP(writer http.ResponseWriter, req *http.Request)
- func (a *Application) Started() time.Time
- func (a *Application) Stats() types.AppStats
- func (a *Application) Stop() error
- func (a *Application) Version() types.AppVersion
- func (a *Application) Wait() error
- type LocationMuxer
- type VirtualHost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupEnv ¶
CleanupEnv has to be called on application shutdown. Will remove the pidfile.
Types ¶
type Application ¶
type Application struct { types.SyncLogger sync.RWMutex // contains filtered or unexported fields }
Application is the type which represents the webserver. It is responsible for parsing the config and it has Start, Stop, Reload and Wait functions.
func New ¶
func New(version types.AppVersion, configGetter config.Getter) (*Application, error)
New creates and returns a new Application with the specified config.
func (*Application) GetLocationFor ¶
func (app *Application) GetLocationFor(host, path string) *types.Location
GetLocationFor returns the Location that mathes the provided host and path
func (*Application) GetUpstream ¶ added in v0.1.6
func (a *Application) GetUpstream(id string) types.Upstream
GetUpstream gets a configured upstream by it's id
func (*Application) Reload ¶
func (a *Application) Reload(cfg *config.Config) error
Reload takse a new configuration and replaces the old one with it. After succesful reload the things that are written in the new config will be in use.
func (*Application) Run ¶
func (a *Application) Run() error
Run fires up the application. And Blocks until it ends
func (*Application) ServeHTTP ¶
func (app *Application) ServeHTTP(writer http.ResponseWriter, req *http.Request)
func (*Application) Started ¶
func (a *Application) Started() time.Time
Started returns when the application was started
func (*Application) Stats ¶
func (a *Application) Stats() types.AppStats
Stats returns application wide stats
func (*Application) Stop ¶
func (a *Application) Stop() error
Stop makes sure the application is completely stopped and all of its goroutines and channels are finished and closed.
func (*Application) Version ¶
func (a *Application) Version() types.AppVersion
Version returns application version
func (*Application) Wait ¶
func (a *Application) Wait() error
Wait subscribes iteself to few signals and waits for any of them to be received. When Wait returns it is the end of the application.
type LocationMuxer ¶
type LocationMuxer struct {
// contains filtered or unexported fields
}
LocationMuxer is muxer for Location types. Given a slice of them it can tell which one should respond to a given path.
func NewLocationMuxer ¶
func NewLocationMuxer(locations []*types.Location) (*LocationMuxer, error)
NewLocationMuxer returns a new LocationMuxer for the given Locations
type VirtualHost ¶
type VirtualHost struct { types.Location Muxer *LocationMuxer }
VirtualHost links a config vritual host to its cache algorithm and a storage object.