Documentation
¶
Index ¶
- Variables
- func ConstructDrainURI(name, uri string, filters []string, params map[string]string) (string, error)
- func NewRetryerForDrain(name string) retry.Retryer
- type DrainConfig
- type DrainConstructor
- type DrainManager
- type DrainProcess
- type DrainType
- type FileDrain
- type IPConnDrain
- type NetDialer
- type RedisDrain
Constants ¶
This section is empty.
Variables ¶
var DRAINS = map[string]DrainConstructor{ "redis": NewRedisDrain, "tcp": NewIPConnDrain, "udp": NewIPConnDrain, "file": NewFileDrain, }
DRAINS is a map of drain type (string) to its constructur function
Functions ¶
func ConstructDrainURI ¶
func ConstructDrainURI( name, uri string, filters []string, params map[string]string) (string, error)
ConstructDrainURI constructs the drain URI from given parameters.
func NewRetryerForDrain ¶
NewRetryerForDrain chooses
Types ¶
type DrainConfig ¶
type DrainConfig struct {
Name string
Type string
Scheme string
Host string // host+port part of the uri (optional in some drains)
Path string
Filters []string // Filter messages by these keys.
Format *template.Template // Format message json using Go's
// template library; if
// format==raw, send the raw
// stream: "<key> <msg>"
Params map[string]string // Params specific to that drain type.
// contains filtered or unexported fields
}
func ParseDrainUri ¶
ParseDrainUri creates a DrainConfig from the drain URI.
func (*DrainConfig) FormatJSON ¶
func (c *DrainConfig) FormatJSON(msg zmqpubsub.Message) ([]byte, error)
FormatJSON formats the given message and returns it with a newline
func (*DrainConfig) GetParam ¶
func (c *DrainConfig) GetParam(key string, def string) string
GetParam returns the corresponding param; else the default value (def)
func (*DrainConfig) GetParamBool ¶
func (c *DrainConfig) GetParamBool(key string, def bool) (bool, error)
func (*DrainConfig) GetParamInt ¶
func (c *DrainConfig) GetParamInt(key string, def int) (int, error)
type DrainConstructor ¶
DrainConstructor is a function that returns a new drain instance
type DrainManager ¶
type DrainManager struct {
// contains filtered or unexported fields
}
func NewDrainManager ¶
func NewDrainManager() *DrainManager
func (*DrainManager) Run ¶
func (manager *DrainManager) Run()
func (*DrainManager) StartDrain ¶
func (manager *DrainManager) StartDrain(name, uri string, retry retry.Retryer)
func (*DrainManager) Stop ¶
func (manager *DrainManager) Stop()
Stop stops the drain manager including running drains
func (*DrainManager) StopDrain ¶
func (manager *DrainManager) StopDrain(drainName string, clearStateCache bool)
type DrainProcess ¶
type DrainProcess struct {
// contains filtered or unexported fields
}
func NewDrainProcess ¶
func NewDrainProcess(name, uri string) (*DrainProcess, error)
func (*DrainProcess) Logf ¶
func (p *DrainProcess) Logf(msg string, v ...interface{}) string
func (*DrainProcess) Start ¶
func (p *DrainProcess) Start() error
func (*DrainProcess) Stop ¶
func (p *DrainProcess) Stop() error
func (*DrainProcess) String ¶
func (p *DrainProcess) String() string
func (*DrainProcess) Wait ¶
func (p *DrainProcess) Wait() error
func (*DrainProcess) WaitRunning ¶
func (p *DrainProcess) WaitRunning() bool
WaitRunning waits until the drain is running
type DrainType ¶
type DrainType interface {
// Start starts the drain, and returns immediately without
// blocking.
Start(*DrainConfig)
Stop() error
Wait() error
WaitRunning() bool
}
func NewFileDrain ¶
func NewIPConnDrain ¶
func NewRedisDrain ¶
type FileDrain ¶
File drain is used to write to local files
func (*FileDrain) Start ¶
func (d *FileDrain) Start(config *DrainConfig)
func (*FileDrain) WaitRunning ¶
type IPConnDrain ¶
IPConnDrain is a drain based on net.IPConn
func (*IPConnDrain) Start ¶
func (d *IPConnDrain) Start(config *DrainConfig)
func (*IPConnDrain) Stop ¶
func (d *IPConnDrain) Stop() error
func (*IPConnDrain) WaitRunning ¶
func (d *IPConnDrain) WaitRunning() bool
type NetDialer ¶
NetDialer provides a channel-friendly wrapper for net.DialTimeout so that it can be used along with `select{}`.
func (*NetDialer) WaitAndClose ¶
func (d *NetDialer) WaitAndClose()
WaitAndClose waits for the connection to return and closes it immediately.
type RedisDrain ¶
func (*RedisDrain) Lpushcircular ¶
Lpushcircular works like LPUSH, but trims the right most element if length exceeds maxlen. Returns the list length before trim.
func (*RedisDrain) Start ¶
func (d *RedisDrain) Start(config *DrainConfig)
func (*RedisDrain) Stop ¶
func (d *RedisDrain) Stop() error
func (*RedisDrain) WaitRunning ¶
func (d *RedisDrain) WaitRunning() bool