package main

/// 2019-09-01 仅监控自身节点，是否被通知退出，处理退出指令.(如果发出退出指令，不能撤销，不能搞的无谓的复杂)

import (
	"../gameapi"
	"../log"
	"../nt"
	"../zkeeper"
	"github.com/samuel/go-zookeeper/zk"
	"go.uber.org/zap"
)

func on_notify_node_event(c *zkeeper.ZkClient, path string, ev zk.EventType) {
	log.Info("zk node changed", zap.String("name", path), zap.Int32("event", int32(ev)))
	if ev == zk.EventNodeDataChanged {
		switch path {
		case nt.ZkP.Wallet:
			gameapi.InitGameAPIConf()
			return
		}
	} else {
		// 属于不受支持的情况，统统报错
		log.Warn("lobby node", zap.String("err", "event not supported currently"))
	}
}
