killyd

package
v0.0.0-...-e6c3f7b Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOG_DEBUG = lg.DEBUG
	LOG_INFO  = lg.INFO
	LOG_WARN  = lg.WARN
	LOG_ERROR = lg.ERROR
	LOG_FATAL = lg.FATAL
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(topicName string, channelName string, channelsMeta ChannelsMeta, ctx *context) *Channel

func (*Channel) Close

func (c *Channel) Close() error

func (*Channel) StartChannel

func (c *Channel) StartChannel()

func (*Channel) StartTikvChannel

func (c *Channel) StartTikvChannel()

type Channels

type Channels map[string]ChannelsMeta

type ChannelsMeta

type ChannelsMeta struct {
	Name          string
	Address       string
	MysqlAddress  string
	Addresses     []string
	MysqlInterval int
	Interval      int
	Username      string
	Password      string
	Db            string
}

type Config

type Config struct {
	Database struct {
		User     string `json:"user"`
		Password string `json:"password"`
		Address  string `json:"address"`
		Name     string `json:"name"`
	} `json:"database"`
	Interval int `json:"interval"` // in seconds
}

type Consumer

type Consumer interface {
	UnPause()
	Pause()
	Close() error
	TimedOutMessage()
	Empty()
}

type Daemon

type Daemon struct {
	SendData TidbEvent

	Config *Config

	ExitChan chan int

	sync.Mutex
	// contains filtered or unexported fields
}

func NewDaemon

func NewDaemon(ctx *context) *Daemon

func (*Daemon) ConversionMinecraft

func (d *Daemon) ConversionMinecraft(data collectors.CollectData)

func (*Daemon) Exit

func (d *Daemon) Exit()

func (*Daemon) Init

func (d *Daemon) Init()

func (*Daemon) Serve

func (d *Daemon) Serve()

func (*Daemon) StartMonitoringEvents

func (d *Daemon) StartMonitoringEvents()

type KILLYD

type KILLYD struct {
	sync.RWMutex

	Meta Meta
	// contains filtered or unexported fields
}

func New

func New(opts *Options) (v *KILLYD, err error)

func (*KILLYD) DeleteExistingTopic

func (v *KILLYD) DeleteExistingTopic(topicName string) error

DeleteExistingTopic removes a topic only if it exists

func (*KILLYD) Exit

func (v *KILLYD) Exit()

func (*KILLYD) GetExistingTopic

func (v *KILLYD) GetExistingTopic(topicName string) (*Topic, error)

GetExistingTopic gets a topic only if it exists

func (*KILLYD) GetTopic

func (v *KILLYD) GetTopic(topicName string) *Topic

GetTopic performs a thread safe operation to return a pointer to a Topic object (potentially new)

func (*KILLYD) Loadmeta

func (v *KILLYD) Loadmeta(meta Meta) error

func (*KILLYD) Main

func (v *KILLYD) Main()

func (*KILLYD) ToMinecraft

func (v *KILLYD) ToMinecraft()

type Logger

type Logger lg.Logger

type Meta

type Meta struct {
	Topics map[string]Channels
}

type Options

type Options struct {
	LogLevel  string `flag:"log-level"`
	LogPrefix string `flag:"log-prefix"`
	Verbose   bool   `flag:"verbose"`
	Logger    Logger

	Timeout      int
	WorkSize     int
	SendWorkSize int
	// contains filtered or unexported fields
}

func NewOptions

func NewOptions() *Options

type TCPMessage

type TCPMessage struct {
	Cmd  string   `json:"cmd,omitempty"`
	Args []string `json:"args,omitempty"`
	// Id is used to associate requests & responses
	ID   int         `json:"id,omitempty"`
	Data interface{} `json:"data,omitempty"`
}

TCPMessage defines what a message that can be sent or received to/from LUA scripts

type Table

type Table struct {
	Name    string     `json:"name"`
	Columns []string   `json:"columns"`
	Data    [][]string `json:"data"`
}

Table represents a table in TiDB

type TidbEvent

type TidbEvent struct {
	TidbConnections  string
	TidbAvailHosts   []string
	TikvAvailHosts   []string
	PdAvailHosts     []string
	TidbUnavailHosts []string
	TikvUnavailHosts []string
	PdUnavailHosts   []string
	TidbNum          string
	TikvNum          string
	PdNum            string
	Totalcap         string
	Totalavail       string
	EveryTikvStatus  interface{}
	sync.RWMutex
}

TidbEvent is one kind of Data that can be transported by a TCPMessage in the Data field.

type Topic

type Topic struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Topic structure

func NewTopic

func NewTopic(topicName string, ctx *context) *Topic

NewTopic is Topic constructor

func (*Topic) Exit

func (t *Topic) Exit() error

Exit Topic

func (*Topic) Exiting

func (t *Topic) Exiting() bool

Exiting checks the exitFlag

func (*Topic) GetChannel

func (t *Topic) GetChannel(channelName string, channelsMeta ChannelsMeta) (channel *Channel)

GetChannel expects the caller to handle locking

func (*Topic) Start

func (t *Topic) Start()

Start Topic

Jump to

Keyboard shortcuts

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