run

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2015 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	Version string
	Commit  string
	Branch  string
}

BuildInfo represents the build details for the server code.

type Command

type Command struct {
	Version string
	Branch  string
	Commit  string

	Closed chan struct{}

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer

	Server *Server
	Logger *log.Logger
	// contains filtered or unexported fields
}

Command represents the command executed by "kapacitord run".

func NewCommand

func NewCommand() *Command

NewCommand return a new instance of Command.

func (*Command) Close

func (cmd *Command) Close() error

Close shuts down the server.

func (*Command) ParseConfig

func (cmd *Command) ParseConfig(path string) (*Config, error)

ParseConfig parses the config at path. Returns a demo configuration if path is blank.

func (*Command) ParseFlags

func (cmd *Command) ParseFlags(args ...string) (Options, error)

ParseFlags parses the command line flags from args and returns an options set.

func (*Command) Run

func (cmd *Command) Run(args ...string) error

Run parses the config from args and runs the server.

type Config

type Config struct {
	HTTP     httpd.Config      `toml:"http"`
	Replay   replay.Config     `toml:"replay"`
	Task     task_store.Config `toml:"task"`
	InfluxDB influxdb.Config   `toml:"influxdb"`
	Logging  logging.Config    `toml:"logging"`

	Graphites []graphite.Config `toml:"graphite"`
	Collectd  collectd.Config   `toml:"collectd"`
	OpenTSDB  opentsdb.Config   `toml:"opentsdb"`
	UDPs      []udp.Config      `toml:"udp"`
	SMTP      smtp.Config       `toml:"smtp"`
	VictorOps victorops.Config  `toml:"victorops"`
	PagerDuty pagerduty.Config  `toml:"pagerduty"`
	Slack     slack.Config      `toml:"slack"`
	Reporting reporting.Config  `toml:"reporting"`
	Stats     stats.Config      `toml:"stats"`

	Hostname string `toml:"hostname"`
	DataDir  string `toml:"data_dir"`
}

Config represents the configuration format for the kapacitord binary.

func NewConfig

func NewConfig() *Config

NewConfig returns an instance of Config with reasonable defaults.

func NewDemoConfig

func NewDemoConfig() (*Config, error)

NewDemoConfig returns the config that runs when no config is specified.

func (*Config) ApplyEnvOverrides

func (c *Config) ApplyEnvOverrides() error

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the config is invalid.

type Options

type Options struct {
	ConfigPath string
	PIDFile    string
	Hostname   string
	CPUProfile string
	MemProfile string
	LogFile    string
	LogLevel   string
}

Options represents the command line options that can be parsed.

type PrintConfigCommand

type PrintConfigCommand struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

PrintConfigCommand represents the command executed by "kapacitord config".

func NewPrintConfigCommand

func NewPrintConfigCommand() *PrintConfigCommand

NewPrintConfigCommand return a new instance of PrintConfigCommand.

func (*PrintConfigCommand) Run

func (cmd *PrintConfigCommand) Run(args ...string) error

Run parses and prints the current config loaded.

type Server

type Server struct {
	TaskMaster *kapacitor.TaskMaster

	LogService      logging.Interface
	HTTPDService    *httpd.Service
	TaskStore       *task_store.Service
	ReplayService   *replay.Service
	InfluxDBService *influxdb.Service

	MetaStore     *metastore
	QueryExecutor *queryexecutor

	Services []Service

	ClusterID string
	ServerID  string

	// Profiling
	CPUProfile string
	MemProfile string

	Logger *log.Logger
	// contains filtered or unexported fields
}

Server represents a container for the metadata and storage data and services. It is built using a Config and it manages the startup and shutdown of all services in the proper order.

func NewServer

func NewServer(c *Config, buildInfo *BuildInfo, logService logging.Interface) (*Server, error)

NewServer returns a new instance of Server built from a config.

func (*Server) Close

func (s *Server) Close() error

Close shuts down the meta and data stores and all services.

func (*Server) Err

func (s *Server) Err() <-chan error

Err returns an error channel that multiplexes all out of band errors received from all services.

func (*Server) Open

func (s *Server) Open() error

Open opens all the services.

type Service

type Service interface {
	Open() error
	Close() error
}

Service represents a service attached to the server.

Jump to

Keyboard shortcuts

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