Apply .gitignore rules
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package gameLogMgr
|
||||
|
||||
// 游戏日志对象
|
||||
type GameLog struct {
|
||||
ServerGroupId int32 // 服务器组Id
|
||||
LogSql string // 日志Sql
|
||||
}
|
||||
|
||||
func newGameLog(serverGroupId int32, logSql string) *GameLog {
|
||||
return &GameLog{
|
||||
ServerGroupId: serverGroupId,
|
||||
LogSql: logSql,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package mysqlSync
|
||||
|
||||
/*
|
||||
提供数据同步到mysql的方法。基本逻辑如下:
|
||||
1、对外接收数据,以追加的方式保存到大文件中。数据的格式为:header(4bytes)+content。
|
||||
2、启动独立的goroutine来从大文件中读取数据,并保存到数据库中。
|
||||
3、使用syncInfo.txt文件保存当前已经处理的文件的路径,以及下一次将要读取的文件的Offset。为了降低向syncInfo.txt文件中写入失败,
|
||||
导致需要从头开始同步数据,所以采用了在指定数目的范围内以追加形式来写入数据的方式;只有达到了指定数量才会将整个文件清空。
|
||||
|
||||
对于错误的处理方式,分为以下两种:
|
||||
1、文件错误:由于文件系统是本系统的核心,所以如果出现文件的读写出错,则需要终止整个进程,所以需要抛出panic。
|
||||
2、数据库错误:当数据库不可访问时,为了不影响整个外部进程的运行,故而不抛出panic,而只是通过monitorNewMgr.Report的方式来报告故障。
|
||||
*/
|
||||
Reference in New Issue
Block a user