示例#1
0
文件: cepm.go 项目: sargun/riak-mesos
func NewCPMd(port int, mgr *metamgr.MetadataManager) *CEPM {
	c := setupCPMd(port)

	var err error
	c.mgr = mgr
	mgr.GetRootNode().CreateChildIfNotExists("cepmd")
	c.cepmdNode, err = mgr.GetRootNode().GetChild("cepmd")
	if err != nil {
		log.Panic("Could not get cepmd child")
	}

	return c
}
示例#2
0
func GetSchedulerState(mm *metadata_manager.MetadataManager) *SchedulerState {
	var zkNode *metadata_manager.ZkNode
	var err error
	zkNode, err = mm.GetRootNode().GetChild("SchedulerState")
	if err == zk.ErrNoNode {
		ess := emptySchedulerState()
		zkNode, err = mm.GetRootNode().MakeChildWithData("SchedulerState", ess.serialize(), false)
		if err != nil {
			log.Panic(err)
		}
		ess.zkNode = zkNode
		return ess
	} else {
		ss, err := DeserializeSchedulerState(zkNode.GetData())
		if err != nil {
			log.Panic(err)
		}
		ss.zkNode = zkNode
		return ss
	}
}