Documentation ¶
Overview ¶
Package cache - in memory and on disk cache - disk for proxies
Copyright (C) Philip Schlump, 2016
Index ¶
- Variables
- func GetTrx(www http.ResponseWriter) (ptr *tr.Trx)
- func GetTrx1(rw *goftlmux.MidBuffer) (ptr *tr.Trx)
- func LookupInLRU(fn string, www http.ResponseWriter, req *http.Request) bool
- func LookupInitByName3(name string) (p int)
- func LookupPluginList() (rv string)
- func NewConstHandler(body, n, v string) http.Handler
- func ReadConfigFile2(fn string)
- func RegInitItem3(name string, fx CreateEmptyFx3, valid string)
- type BotHandler
- func (hdlr *BotHandler) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *BotHandler) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr *BotHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)
- type CacheHandlerType
- func (hdlr *CacheHandlerType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *CacheHandlerType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr *CacheHandlerType) ServeHTTP(www http.ResponseWriter, req *http.Request)
- type ConstHandler
- type CreateEmptyFx3
- type GoFTLMiddleWare
- type GoFtlHttpServer
- type GoTemplateServer
- func (hdlr *GoTemplateServer) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *GoTemplateServer) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr GoTemplateServer) ServeHTTP(www http.ResponseWriter, req *http.Request)
- type LRUItemType
- type MidServer
- func (hdlr *MidServer) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *MidServer) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (ms *MidServer) ServeHTTP(wr http.ResponseWriter, req *http.Request)
- func (ms *MidServer) SetInfo(s string)
- type SimpleFileServer
- func (hdlr *SimpleFileServer) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *SimpleFileServer) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr *SimpleFileServer) ServeHTTP(www http.ResponseWriter, req *http.Request)
- type SimpleProxyHandlerType
- func (hdlr *SimpleProxyHandlerType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *SimpleProxyHandlerType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr SimpleProxyHandlerType) ServeHTTP(www http.ResponseWriter, req *http.Request)
- type StripPrefixType
- func (hdlr *StripPrefixType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *StripPrefixType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr StripPrefixType) ServeHTTP(www http.ResponseWriter, req *http.Request)
- type TopHandler
- func (hdlr *TopHandler) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *TopHandler) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr *TopHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
var ErrInternalError = errors.New("Internal Error")
var ErrInvalidConfiguration = errors.New("Invalid Configuration")
var ErrMuxError = errors.New("Mux reported an error")
var ErrNonMidBufferWriter = errors.New("Invalid type - needs to be a goftlmux.MidBuffer")
var FtlConfigError = errors.New("Invalid type supplied to configuration function")
var NewInit3 []GoFtlHttpServer
var NormalUnused []goftlmux.UnusedParam
Functions ¶
func LookupInLRU ¶
func LookupInitByName3 ¶
func NewConstHandler ¶
func NewConstHandler() *ConstHandler {
func ReadConfigFile2 ¶
func ReadConfigFile2(fn string)
func RegInitItem3 ¶
func RegInitItem3(name string, fx CreateEmptyFx3, valid string)
/Users/corwin/go/src/github.com/pschlump/Go-FTL/server/cfg/cfg.go
Types ¶
type BotHandler ¶
type BotHandler struct { }
func (*BotHandler) InitializeWithConfigData ¶
func (hdlr *BotHandler) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*BotHandler) PreValidate ¶
func (hdlr *BotHandler) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (*BotHandler) ServeHTTP ¶
func (hdlr *BotHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)
type CacheHandlerType ¶
type CacheHandlerType struct { Next http.Handler Paths []string CacheDir string CacheSize int64 LimitTooBig int64 }
func NewCacheServer ¶
func (*CacheHandlerType) InitializeWithConfigData ¶
func (hdlr *CacheHandlerType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*CacheHandlerType) PreValidate ¶
func (hdlr *CacheHandlerType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (*CacheHandlerType) ServeHTTP ¶
func (hdlr *CacheHandlerType) ServeHTTP(www http.ResponseWriter, req *http.Request)
ServeHTTP(www http.ResponseWriter, req *http.Request)
type ConstHandler ¶
---------------------------------------------------------------------------------------------------------------------------------------------------- Return a constant string value. ---------------------------------------------------------------------------------------------------------------------------------------------------- ct := h.Get("Content-Type") if rw.StatusCode == http.StatusOK && strings.HasPrefix(ct, "application/json") {
func (ConstHandler) ServeHTTP ¶
func (hdlr ConstHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)
type CreateEmptyFx3 ¶
type CreateEmptyFx3 func(name string) GoFTLMiddleWare
------------------------------------------------------------------------------------------------------------------------------------------------- new interface based -------------------------------------------------------------------------------------------------------------------------------------------------
type GoFTLMiddleWare ¶
type GoFTLMiddleWare interface { // InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (rv GoFTLMiddleWare, err error) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error) ServeHTTP(www http.ResponseWriter, req *http.Request) }
func NewTopHandler ¶
func NewTopHandler(next http.Handler, gCfg *cfg.ServerGlobalConfigType, ppCfg interface{}, serverName string, pNo int) GoFTLMiddleWare
type GoFtlHttpServer ¶
type GoFtlHttpServer struct { Name string // Name of this (the directive this is called by ValidJSON string // JSONP/JsonX validaiton string for config for this item CreateEmpty CreateEmptyFx3 // CallNo int // }
type GoTemplateServer ¶
type GoTemplateServer struct { Next http.Handler // No Next, this is the bottom of the stack. Paths []string Root []string IndexFileList []string LineNo int }
func NewGoTemplateServer ¶
func (*GoTemplateServer) InitializeWithConfigData ¶
func (hdlr *GoTemplateServer) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*GoTemplateServer) PreValidate ¶
func (hdlr *GoTemplateServer) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (GoTemplateServer) ServeHTTP ¶
func (hdlr GoTemplateServer) ServeHTTP(www http.ResponseWriter, req *http.Request)
This is the bottom of the stack - at this point we check
- If the file is in the in-memory cache
- If the file is on disk
Also this is the simple server - only one location to check.
type LRUItemType ¶
type MidServer ¶
type MidServer struct { Info string // contains filtered or unexported fields }
func (*MidServer) InitializeWithConfigData ¶
func (*MidServer) PreValidate ¶
type SimpleFileServer ¶
type SimpleFileServer struct { Next http.Handler // No Next, this is the bottom of the stack. Paths []string Root []string IndexFileList []string LineNo int }
func NewSimpleFileServer ¶
func (*SimpleFileServer) InitializeWithConfigData ¶
func (hdlr *SimpleFileServer) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*SimpleFileServer) PreValidate ¶
func (hdlr *SimpleFileServer) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (*SimpleFileServer) ServeHTTP ¶
func (hdlr *SimpleFileServer) ServeHTTP(www http.ResponseWriter, req *http.Request)
type SimpleProxyHandlerType ¶
type SimpleProxyHandlerType struct { Next http.Handler Paths []string Dest string LineNo int // contains filtered or unexported fields }
func NewSimpleProxyServer ¶
func NewSimpleProxyServer(n http.Handler, p []string, d string) *SimpleProxyHandlerType
func (*SimpleProxyHandlerType) InitializeWithConfigData ¶
func (hdlr *SimpleProxyHandlerType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*SimpleProxyHandlerType) PreValidate ¶
func (hdlr *SimpleProxyHandlerType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (SimpleProxyHandlerType) ServeHTTP ¶
func (hdlr SimpleProxyHandlerType) ServeHTTP(www http.ResponseWriter, req *http.Request)
type StripPrefixType ¶
type StripPrefixType struct { Next http.Handler // Paths []string // Prefix string // regular expression // contains filtered or unexported fields }
func NewStripPrefixServer ¶
func NewStripPrefixServer(n http.Handler, p []string, h, v string) *StripPrefixType
func (*StripPrefixType) InitializeWithConfigData ¶
func (hdlr *StripPrefixType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*StripPrefixType) PreValidate ¶
func (hdlr *StripPrefixType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (StripPrefixType) ServeHTTP ¶
func (hdlr StripPrefixType) ServeHTTP(www http.ResponseWriter, req *http.Request)
type TopHandler ¶
type TopHandler struct { Format string Root []string Next http.Handler // Required field for all chaining of middleware. }
func (*TopHandler) InitializeWithConfigData ¶
func (hdlr *TopHandler) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*TopHandler) PreValidate ¶
func (hdlr *TopHandler) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (*TopHandler) ServeHTTP ¶
func (hdlr *TopHandler) ServeHTTP(www http.ResponseWriter, req *http.Request)