sync2db

package
v0.0.0-...-4ea7438 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenQuitAndDump

func ListenQuitAndDump()

ListenQuitAndDump 函数将会阻塞直到 INT/USR1/USR2 信号到来

func ListenQuitAndDumpAndReload

func ListenQuitAndDumpAndReload(reload SignalRelodFunc)

func ListenSignal

func ListenSignal(handler SignalHandleFunc, reload SignalRelodFunc, signals ...os.Signal)

ListenSignal 监听信号 signals, 当收到其中一个信号时调用 handler 函数将会阻塞直到指定的信号到来且 handler 处理信号后返回true(如果返回false,会继续接受信号)

func QuitAndDumpAndReload

func QuitAndDumpAndReload(sig os.Signal, reload SignalRelodFunc) bool

QuitAndDumpAndReload 这是一个 SignalHandleFunc,用于退出或dump进程 退出监听: syscall.SIGINT, syscall.SIGUSR1 dump监听: syscall.SIGUSR2 使用 kill 命令时可以带上信号参数:

kill -s INT <pid> 杀进程
kill -s USR1 <pid> reload配置
kill -s USR2 <pid> dump内存堆栈

Types

type SignalHandleFunc

type SignalHandleFunc func(sig os.Signal, reload SignalRelodFunc) (ret bool)

type SignalRelodFunc

type SignalRelodFunc func()

type Sync2DB

type Sync2DB struct {
	*db_lazy.LazyMysql
	// contains filtered or unexported fields
}

func NewSync2DB

func NewSync2DB(mysqlOrm *xorm.Engine, lazyTimeSecond int, wait *sync.WaitGroup) *Sync2DB

func (*Sync2DB) Create2DB

func (s *Sync2DB) Create2DB(bean interface{}) error

func (*Sync2DB) IsShowLog

func (s *Sync2DB) IsShowLog(isShow bool)

func (*Sync2DB) Printf

func (s *Sync2DB) Printf(format string, a ...interface{})

func (*Sync2DB) Printfln

func (s *Sync2DB) Printfln(format string, a ...interface{})

Jump to

Keyboard shortcuts

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