Documentation ¶
Overview ¶
Package server provides the core runtime for Blip.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ControlChans ¶
func ControlChans() (stopChan, doneChan chan struct{})
ControlChans is a convenience function to return arguments for Run.
Types ¶
type CommandLine ¶
CommandLine represents options (--addr, etc.) and args: entity type, return labels, and query predicates. The caller is expected to copy and use the embedded structs separately, like:
var o config.Options = cmdLine.Options for i, arg := range cmdline.Args {
func ParseCommandLine ¶
func ParseCommandLine(args []string) (CommandLine, error)
ParseCommandLine parses the command line and env vars. Command line options override env vars. Default options are used unless overridden by env vars or command line options. Defaults are usually parsed from config files.
type Options ¶
type Options struct { Config string `arg:"env:BLIP_CONFIG"` Debug bool `arg:"env:BLIP_DEBUG"` Help bool Log bool `arg:"env:BLIP_LOG"` PrintConfig bool `arg:"--print-config"` PrintDomains bool `arg:"--print-domains"` PrintMonitors bool `arg:"--print-monitors"` PrintPlans bool `arg:"--print-plans"` Run bool `arg:"env:BLIP_RUN" default:"true"` Version bool `arg:"-v"` }
Options represents typical command line options: --addr, --config, etc.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the core runtime for one instance of Blip. It's responsible for starting and running everything: Boot and Run, respectively. As long as the server is running, Blip is running.
See bin/blip/main.go for the simplest use case.
func (*Server) Boot ¶
Boot boots Blip. That means it loads, validates, and creates everything, but it doesn't start (run) anything--that happens when Run is called. If Boot returns nil, then Blip is ready to run; else, any error is fatal: sometimes is too wrong for Blip to run (for example, an invalid config).
Boot must be called once before Run.