public void Identity(string roundName)
{
if (electionDict.ContainsKey(roundName))
{
return;
}
var roundsRoot = string.Format("/{0}Rounds", RoutingRule.DistrictsName);
var thisRound = string.Format("{0}/{1}", roundsRoot, roundName);
try
{
handle.Create(roundsRoot, null, Ids.OPEN_ACL_UNSAFE, CreateMode.Persistent);
}
catch (KeeperException.NodeExistsException e)
{
// ignore
}
try
{
handle.Create(thisRound, null, Ids.OPEN_ACL_UNSAFE, CreateMode.Persistent);
}
catch (KeeperException.NodeExistsException e)
{
// ignore
}
var me = string.Format("{0}/{1}-n_", thisRound, uuid);
var ret = handle.Create(me, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EphemeralSequential);
var elect = new Election(handle, thisRound, roundName, Election.PathToSeq(ret));
electionDict[roundName] = elect;
elect.AttempToBecomeLeader();
}