Documentation ¶
Overview ¶
Package agent runs readers, writers, and HTTP server.
Index ¶
- type Agent
- func (a *Agent) GetRun(config resourced_config.Config) ([]byte, error)
- func (a *Agent) GetRunByPath(path string) ([]byte, error)
- func (a *Agent) HttpRouter() *httprouter.Router
- func (a *Agent) ListenAndServe(addr string) error
- func (a *Agent) ListenAndServeTLS(addr string, certFile string, keyFile string) error
- func (a *Agent) MapReadersGetHandlers() map[string]func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (a *Agent) MapWritersGetHandlers() map[string]func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (a *Agent) PathsGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (a *Agent) ReaderPathsGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (a *Agent) ReadersGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (a *Agent) RootGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (a *Agent) Run(config resourced_config.Config) (output []byte, err error)
- func (a *Agent) RunAllForever()
- func (a *Agent) RunForever(config resourced_config.Config)
- func (a *Agent) WriterPathsGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (a *Agent) WritersGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { ConfigStorage *resourced_config.ConfigStorage DbPath string Db *bolt.DB Tags []string }
Agent struct carries most of the functionality of ResourceD. It collects information through readers and serve them up as HTTP+JSON.
func (*Agent) GetRun ¶
func (a *Agent) GetRun(config resourced_config.Config) ([]byte, error)
GetRun returns the JSON data stored in local storage given Config struct.
func (*Agent) GetRunByPath ¶
GetRunByPath returns JSON data stored in local storage given path string.
func (*Agent) HttpRouter ¶
func (a *Agent) HttpRouter() *httprouter.Router
HttpRouter returns HTTP router.
func (*Agent) ListenAndServe ¶
ListenAndServe runs HTTP server.
func (*Agent) ListenAndServeTLS ¶
ListenAndServe runs HTTPS server.
func (*Agent) MapReadersGetHandlers ¶
func (a *Agent) MapReadersGetHandlers() map[string]func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
MapReadersGetHandlers returns functions that handle readers paths.
func (*Agent) MapWritersGetHandlers ¶
func (a *Agent) MapWritersGetHandlers() map[string]func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
MapWritersGetHandlers returns functions that handle writers paths.
func (*Agent) PathsGetHandler ¶
func (a *Agent) PathsGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
PathsGetHandler returns function that shows all the paths.
func (*Agent) ReaderPathsGetHandler ¶
func (a *Agent) ReaderPathsGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ReaderPathsGetHandler returns function that shows all the readers paths.
func (*Agent) ReadersGetHandler ¶
func (a *Agent) ReadersGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ReadersGetHandler returns function that handles all readers.
func (*Agent) RootGetHandler ¶
func (a *Agent) RootGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
RootGetHandler returns function that handles all readers and writers.
func (*Agent) Run ¶
func (a *Agent) Run(config resourced_config.Config) (output []byte, err error)
Run executes a reader/writer config. Run will save reader data as JSON in local db.
func (*Agent) RunAllForever ¶
func (a *Agent) RunAllForever()
RunAllForever executes all readers & writers in an infinite loop.
func (*Agent) RunForever ¶
func (a *Agent) RunForever(config resourced_config.Config)
RunForever executes Run() in an infinite loop with a sleep of config.Interval.
func (*Agent) WriterPathsGetHandler ¶
func (a *Agent) WriterPathsGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
WriterPathsGetHandler returns function that shows all the writers paths.
func (*Agent) WritersGetHandler ¶
func (a *Agent) WritersGetHandler() func(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
WritersGetHandler returns function that handles all writers.