Documentation ¶
Index ¶
- Constants
- Variables
- func LevelFilter() *logutils.LevelFilter
- func NewLogWriter(buf int) *logWriter
- func ValidateLevelFilter(minLevel logutils.LogLevel, filter *logutils.LevelFilter) bool
- type Agent
- type AgentIPC
- type AppendSliceValue
- type Command
- type Config
- type GatedWriter
- type IPCClient
- type LogHandler
- type RPCClient
Constants ¶
const ( MinIPCVersion = 1 MaxIPCVersion = 1 )
Protocol versions
Variables ¶
var DefaultConfig = &Config{
LogLevel: "INFO",
RPCAddr: "127.0.0.1:6673",
}
DefaultConfig contains the defaults for configurations.
Functions ¶
func LevelFilter ¶
func LevelFilter() *logutils.LevelFilter
LevelFilter returns a LevelFilter that is configured with the log levels that we use.
func NewLogWriter ¶
func NewLogWriter(buf int) *logWriter
NewLogWriter creates a logWriter with the given buffer capacity
func ValidateLevelFilter ¶
func ValidateLevelFilter(minLevel logutils.LogLevel, filter *logutils.LevelFilter) bool
ValidateLevelFilter verifies that the log levels within the filter are valid.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent starts and manages the Watchdog instance.
func (*Agent) RegisterProcess ¶
RegisterProcess takes a configuration file and registers a new process
func (*Agent) ShutdownCh ¶
func (a *Agent) ShutdownCh() <-chan struct{}
ShutdownCh returns a channel that can be selected to wait for the agent to perform a shutdown.
type AgentIPC ¶
type AppendSliceValue ¶
type AppendSliceValue []string
AppendSliceValue implements the flag.Value interface and allows multiple calls to the same variable to append a list.
func (*AppendSliceValue) Set ¶
func (s *AppendSliceValue) Set(value string) error
func (*AppendSliceValue) String ¶
func (s *AppendSliceValue) String() string
type Command ¶
type Command struct { Ui cli.Ui ShutdownCh <-chan struct{} // contains filtered or unexported fields }
Command is a Command implementation that runs a Watchdog agent. The command will not end unless a shutdown message is sent on the ShutdownCh. If two messages are sent on the ShutdownCh it will forcibly exit.
type Config ¶
type Config struct { // LogLevel is the level of the logs to output. // This can be updated during a reload. LogLevel string `mapstructure:"log_level"` // RPCAddr is the address and port to listen on for the agent's RPC // interface. RPCAddr string `mapstructure:"rpc_addr"` }
Config is the configuration that can be set for an Agent. Some of these configurations are exposed as command-line flags to `serf agent`, whereas many of the more advanced configurations can only be set by creating a configuration file.
func DecodeConfigFromJSON ¶
DecodeConfigFromJSON decodes a JSON config
func DecodeConfigFromTOML ¶
DecodeConfigFromTOML decodes a TOML config
func MergeConfig ¶
MergeConfig merges two configurations together to make a single new configuration.
func ReadConfigPaths ¶
ReadConfigPaths reads the paths in the given order to load configurations. The paths can be to files or directories. If the path is a directory, we read one directory deep and read any files ending in ".json" as configuration files.
type GatedWriter ¶
GatedWriter is an io.Writer implementation that buffers all of its data into an internal buffer until it is told to let data through.
func (*GatedWriter) Flush ¶
func (w *GatedWriter) Flush()
Flush tells the GatedWriter to flush any buffered data and to stop buffering.
type IPCClient ¶
type IPCClient struct {
// contains filtered or unexported fields
}
type LogHandler ¶
type LogHandler interface {
HandleLog(string)
}
LogHandler interface is used for clients that want to subscribe to logs, for example to stream them over an IPC mechanism
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient is the RPC client to make requests to the agent RPC.
func NewRPCClient ¶
NewRPCClient is used to create a new RPC client given the address. This will properly dial, handshake, and start listening