Documentation ¶
Index ¶
- Constants
- func AfterReLoadConfig(pconfig *Config, old_config *FileConfig, new_config *FileConfig)
- func CalcRedisConn(pconfig *Config) int
- func CloseRedis(pconfig *Config)
- func CommSet(pconfig *Config) bool
- func HandleReportCmd(pconfig *Config, pmsg *comm.ReportMsg)
- func HeartBeatToRedis(arg interface{})
- func InitRedisDb(arg interface{})
- func LocalSet(pconfig *Config) bool
- func OpenRedis(pconfig *Config) bool
- func RecvHeartBeatReq(pconfig *Config, preq *ss.MsgHeartBeatReq, from int)
- func RecvMsg(pconfig *Config) int64
- func RecvRegReq(pconfig *Config, preq *ss.MsgRegReq, from int)
- func RecvReportCmd(arg interface{})
- func RecvUserLoginReq(pconfig *Config, preq *ss.MsgLoginReq, from int)
- func RecvUserLogoutReq(pconfig *Config, preq *ss.MsgLogoutReq, from int)
- func ReportSyncServer(arg interface{})
- func ResetRedis(pconfig *Config, old_config *FileConfig, new_config *FileConfig)
- func SelectRedisClient(pconfig *Config, redis_opt int) *comm.RedisClient
- func SendHeartBeatMsg(arg interface{})
- func SendRegRsp(pconfig *Config, preq *ss.MsgRegReq, target_serv int, result ss.REG_RESULT)
- func SendToServ(pconfig *Config, target_serv int, pss_msg *ss.SSMsg) bool
- func ServerExit(pconfig *Config)
- func ServerStart(pconfig *Config)
- type Config
- type FileConfig
- type Msg
- type RedisClientInfo
Constants ¶
View Source
const ( PASSWD_SALT_LEN = 32 LOGIN_LOCK_LIFE = 20 //login lock life (second) FORMAT_TAB_USER_GLOBAL = "users:global:%s" //users:global:[name] ++ hash ++ name | pass | uid | salt FORMAT_TAB_USER_INFO_REFIX = "user:" // user:[uid] ++ hash ++ uid | name | age | sex | addr | level | online_logic | blob_info FORMAT_TAB_USER_LOGIN_LOCK_PREFIX = "user:login_lock:" //user:login:[uid] <string> valid_second FORMAT_TAB_GLOBAL_UID = "global:uid" // ++ string //Useful FIELD FIELD_USER_INFO_ONLINE_LOGIC = "online_logic" //REDIS METHOD REDIS_METHOD_SINGLE = 0 //simplest method ,only use addr[0] as read and write candidate REDIS_METHOD_SM = 1 //1 master and many slaves. ps:addr[0] is defined as master //REDIS OPERATION REDIS_OPT_R = 1 //only for read operation,may dispatch to slave REDIS_OPT_W = 2 //write operation will only disaptch to master REDIS_OPT_RW = REDIS_OPT_R | REDIS_OPT_W )
View Source
const (
MESSAGE_LEN = ss.MAX_SS_MSG_SIZE //200k
)
Variables ¶
This section is empty.
Functions ¶
func AfterReLoadConfig ¶
func AfterReLoadConfig(pconfig *Config, old_config *FileConfig, new_config *FileConfig)
After ReLoad Config If Need Handle
func HandleReportCmd ¶
func HeartBeatToRedis ¶
func HeartBeatToRedis(arg interface{})
func InitRedisDb ¶
func InitRedisDb(arg interface{})
init db info when first started only use addr[0] as master
func RecvHeartBeatReq ¶
func RecvHeartBeatReq(pconfig *Config, preq *ss.MsgHeartBeatReq, from int)
func RecvReportCmd ¶
func RecvReportCmd(arg interface{})
func RecvUserLoginReq ¶
func RecvUserLoginReq(pconfig *Config, preq *ss.MsgLoginReq, from int)
user login
func RecvUserLogoutReq ¶
func RecvUserLogoutReq(pconfig *Config, preq *ss.MsgLogoutReq, from int)
user logout
func ReportSyncServer ¶
func ReportSyncServer(arg interface{})
func ResetRedis ¶
func ResetRedis(pconfig *Config, old_config *FileConfig, new_config *FileConfig)
ResetRedis must ensure pconfig.RedisClients all member not nil!
func SelectRedisClient ¶
func SelectRedisClient(pconfig *Config, redis_opt int) *comm.RedisClient
select a proper client to exe cmd
func SendHeartBeatMsg ¶
func SendHeartBeatMsg(arg interface{})
func SendRegRsp ¶
func SendToServ ¶
send to other server
Types ¶
type Config ¶
type Config struct { //comm NameSpace string ProcId int ProcName string ConfigFile string Daemon bool FileConfig *FileConfig Comm *comm.CommConfig ReportCmd string //used for report cmd ReportCmdToken int64 ReportServ *comm.ReportServ //report to manger //local RedisClients []*RedisClientInfo }
type FileConfig ¶
type FileConfig struct { // ProcName string `json:"proc_name"` TargetServs []int `json:"target_servs"` //target serv set LogFile string `json:"log_file"` RedisMethod int `json:"redis_method"` RedisAddr []string `json:"redis_addr"` MaxConn int `json:"max_conn"` //max redis-conn of process NormalConn int `json:"normal_conn"` //normal redis-conn AuthPass string `json:"auth_pass"` ManageAddr []string `json:"manage_addr"` InitRedisAfter int `json:"init_redis_after"` //init redis db info after start xx seconds InitUid int64 `json:"init_uid"` //init uid number UidIncr int `json:"uid_incr"` //uid incr step MonitorInv int `json:"monitor_inv"` //monitor interval seconds }
type RedisClientInfo ¶
type RedisClientInfo struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.