agent

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2015 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package agent runs readers, writers, and HTTP server.

Index

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 NewAgent

func NewAgent() (*Agent, error)

NewAgent is the constructor for Agent struct.

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

func (a *Agent) GetRunByPath(path string) ([]byte, error)

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

func (a *Agent) ListenAndServe(addr string) error

ListenAndServe runs HTTP server.

func (*Agent) ListenAndServeTLS

func (a *Agent) ListenAndServeTLS(addr string, certFile string, keyFile string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL