observer

package
v0.0.0-...-1609ee8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseObserver

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

BaseObserver implement the Observer GetID and SetID method

type MySQLDest

type MySQLDest struct {
	Host     string
	Port     uint16
	Username string
	Password string
	Charset  string
	Text     bool
}

MySQLDest is the config show how to synchronize binlog data to destinate MySQL

type MySQLObserver

type MySQLObserver struct {
	BaseObserver
	// contains filtered or unexported fields
}

MySQLObserver observe binlog events and translate to SQL statement, and execute to destinate database

func NewMySQLObserver

func NewMySQLObserver(dsts []MySQLDest) (*MySQLObserver, error)

NewMySQLObserver create an observer observe binlog event and synchronize to MySQL

func (*MySQLObserver) OnEvent

func (o *MySQLObserver) OnEvent(evt *binlog.Event) error

type NotifyChain

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

NotifyChain holds observers and notify them if event happened

func (*NotifyChain) AddObserver

func (c *NotifyChain) AddObserver(ob Observer)

AddObserver add a observer to the chain

func (*NotifyChain) Broadcast

func (c *NotifyChain) Broadcast(evt *binlog.Event) error

Broadcast notify all observer event occurs

func (*NotifyChain) RemoveObserver

func (c *NotifyChain) RemoveObserver(ob Observer)

RemoveObserver remove a observer from the chain

type Observer

type Observer interface {
	OnEvent(*binlog.Event) error
	GetID() int
	SetID(int)
}

Observer can observe binlog event

Jump to

Keyboard shortcuts

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