Documentation ¶
Index ¶
- Variables
- func GetEndpoint(datadir string, uri string) (method string, host string, err error)
- func GetPlugin(plugin, uri string) (string, string, string)
- func NewReverseProxy(datadir, uri string) (http.Handler, error)
- func ParseUnixSock(datadir string, uri string) (sockfile string, requestPath string, err error)
- func Request(h http.Handler, method, path string, body interface{}, ...) (*bytes.Buffer, error)
- func RequestWithContext(adb *database.AdminDB, h http.Handler, method, path string, body interface{}, ...) (*bytes.Buffer, error)
- func Route(m *chi.Mux, route string, h http.Handler) error
- func WaitForAPI(method string, host string, timeout time.Duration) error
- func WaitForEndpoint(method string, host string, e *Cmd) error
- func WithNilInfo(bis BuiltinStartFunc) func(*database.AdminDB) error
- type APIHandler
- type BuiltinHandler
- type BuiltinHelper
- type BuiltinRunner
- type BuiltinStartFunc
- type ChiClearer
- type Cmd
- type ExecHandler
- type Info
- type Manager
- func (m *Manager) Find(plugin, name string) (*Runner, error)
- func (m *Manager) GetHandler(plugin, uri string) (http.Handler, error)
- func (m *Manager) Kill() error
- func (m *Manager) Start(plugin, name string, run *assets.Run) error
- func (m *Manager) Stop(plugin, name string) error
- func (m *Manager) StopPlugin(plugin string) error
- type Runner
- type StartMessage
- type TypeHandler
Constants ¶
This section is empty.
Variables ¶
var Builtin = make(builtinRunnerMap)
Functions ¶
func GetEndpoint ¶
GetEndpoint parses the given URI and returns an endpoint
func NewReverseProxy ¶
NewReverseProxy generates a reverse proxy from a given uri, automatically handling unix sockets, and builtin handlers
func ParseUnixSock ¶
Extracts the unix socket file and request path
func Request ¶
func Request(h http.Handler, method, path string, body interface{}, headers map[string]string) (*bytes.Buffer, error)
Request runs the given http handler, and optionally unmarshals the result
func RequestWithContext ¶
func RequestWithContext(adb *database.AdminDB, h http.Handler, method, path string, body interface{}, headers map[string]string) (*bytes.Buffer, error)
RequestWithContext is just like request, but it also creates a heedy request context, so that it can request things from builtin plugins
func WaitForAPI ¶
WaitForAPI is like WaitForEndpoint, but it doesn't have a cmd.
func WaitForEndpoint ¶
WaitForEndpoint waits for the given endpoint
func WithNilInfo ¶
func WithNilInfo(bis BuiltinStartFunc) func(*database.AdminDB) error
WithNilInfo can be used to convert a plugin start func that doesn't require an Info struct into a function compatible with database.AddCreateHook.
Types ¶
type APIHandler ¶
func NewAPIHandler ¶
func NewAPIHandler(M *Manager, runtype string, rtv assets.RunType) *APIHandler
func (*APIHandler) Kill ¶
func (ah *APIHandler) Kill(apikey string) error
func (*APIHandler) Run ¶
func (ah *APIHandler) Run(i *Info) error
func (*APIHandler) Stop ¶
func (ah *APIHandler) Stop(apikey string) error
type BuiltinHandler ¶
type BuiltinHandler struct { DB *database.AdminDB Running map[string]string // contains filtered or unexported fields }
func NewBuiltinHandler ¶
func NewBuiltinHandler(db *database.AdminDB, m *Manager) *BuiltinHandler
func (*BuiltinHandler) Kill ¶
func (bg *BuiltinHandler) Kill(apikey string) error
func (*BuiltinHandler) Run ¶
func (bh *BuiltinHandler) Run(i *Info) (err error)
func (*BuiltinHandler) Stop ¶
func (bh *BuiltinHandler) Stop(apikey string) error
type BuiltinRunner ¶
type BuiltinRunner struct { Key string Start BuiltinStartFunc Stop func(db *database.AdminDB, apikey string) error Handler http.Handler }
Builtin is passed in to the BuiltinHandler with
type BuiltinStartFunc ¶
type BuiltinStartFunc func(db *database.AdminDB, i *Info, h BuiltinHelper) error
func WithVersion ¶
func WithVersion(pluginName string, dbversion int, pstart func(*database.AdminDB, *Info, BuiltinHelper, int) error) BuiltinStartFunc
type ChiClearer ¶
func (ChiClearer) ServeHTTP ¶
func (cc ChiClearer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ExecHandler ¶
func NewExecHandler ¶
func NewExecHandler(db *database.AdminDB) *ExecHandler
func (*ExecHandler) Kill ¶
func (e *ExecHandler) Kill(apikey string) error
func (*ExecHandler) Run ¶
func (e *ExecHandler) Run(i *Info) error
func (*ExecHandler) Stop ¶
func (e *ExecHandler) Stop(apikey string) error
type Manager ¶
type Manager struct { sync.RWMutex DB *database.AdminDB RunTypes map[string]TypeHandler Runners map[string]*Runner // The APIKey that represents the "core" heedy server CoreKey string // contains filtered or unexported fields }
func NewManager ¶
func (*Manager) StopPlugin ¶
type StartMessage ¶
type StartMessage struct {
API string `json:"api"`
}