示例#1
0
        public void NewMemberReconfigure(HostInfo newMember)
        {
            deploymentConfig.Hosts.Add(newMember);
            allActors = Deployment.ReachActors(newMember, Context.System, allActors);
            var pendingReliableOverlayGraph = GraphCreator.ComputeAllReliableSuccessors(algorithmConfig, allActors);

            reliableSuccessors.Clear();

            foreach (var s in pendingReliableOverlayGraph[Self])
            {
                reliableSuccessors.Add(s);
                Context.Watch(s);
            }

            foreach (var s in reliableOverlayGraph[Self])
            {
                if (!reliableSuccessors.Contains(s))
                {
                    Context.Unwatch(s);
                }
            }

            reliableOverlayGraph = pendingReliableOverlayGraph;

            var pendingPredecessors = GraphCreator.ComputeInverse(reliableOverlayGraph, Self);

            foreach (var a in pendingPredecessors)
            {
                Context.Watch(a);
            }

            foreach (var a in predecessors)
            {
                if (!pendingPredecessors.Contains(a))
                {
                    Context.Unwatch(a);
                }
            }

            predecessors = pendingPredecessors;

            trackingGraphs = new Dictionary <IActorRef, TrackingGraph>();
            foreach (var a in allActors)
            {
                trackingGraphs[a] = new TrackingGraph(reliableOverlayGraph, a);
            }
            trackingGraphs[Self].Clear();
        }
示例#2
0
        public void Initialize(Messages.InitServer m)
        {
            currentRound = m.Round;

            algorithmConfig  = m.AlgortihmConfig;
            deploymentConfig = new DeploymentConfig(m.Hosts.ToHashSet(), m.ServerHost, m.ServerNumber);

            foreach (var a in m.AllActors)
            {
                allActors.Add(a);
            }

            reliableOverlayGraph = GraphCreator.ComputeAllReliableSuccessors(algorithmConfig, allActors);

            SendGraphLogMsg(reliableOverlayGraph);

            foreach (var a in reliableOverlayGraph[Self])
            {
                reliableSuccessors.Add(a);
                Context.Watch(a);
            }

            predecessors = GraphCreator.ComputeInverse(reliableOverlayGraph, Self);
            foreach (var a in predecessors)
            {
                Context.Watch(a);
            }

            foreach (var a in allActors)
            {
                trackingGraphs[a] = new TrackingGraph(reliableOverlayGraph, a);
            }
            trackingGraphs[Self].Clear();

            BecomeReady();
        }