view topology/manager/TopologyManager.cs @ 71:1169915705ab default tip

fix TopologyNode connect
author KaitoMaeshiro <aosskaito@cr.ie.u-ryukyu.ac.jp>
date Sun, 06 Feb 2022 16:47:41 +0900
parents 976d43003487
children
line wrap: on
line source

using System;
using System.Collections.Generic;
using Christie_net.annotation;
using Christie_net.codegear;


namespace Christie_net.topology.manager {

    public class TopologyManager : CodeGear {
        [Peek] public TopologyManagerConfig topologyManagerConfig;
        
        public TopologyManager() {
        }

        public override void Run(CodeGearManager cgm) {
            cgm.Setup(new CheckComingHost());
            GetLocalDgm().Put("absCookieTable", new Dictionary<String, String>());
            
            if(topologyManagerConfig.dynamic) {
                GetLocalDgm().Put("running", true);
                GetLocalDgm().Put("_STARTMESSAGE", new Message());

                if (topologyManagerConfig.type == TopologyType.Tree) {
                    GetLocalDgm().Put("parentManager", new ParentManager(topologyManagerConfig.hasChild));
                    GetLocalDgm().Put("nameTable", new Dictionary<String, HostMessage>());
                    GetLocalDgm().Put("hostCount", 0);
                    cgm.Setup(new CreateTreeTopology());
                    //cgm.setup(new ReceiveDisconnectMessage());
                }else{
                    GetLocalDgm().Put("running", false);
                    //cgm.Setup(new FileParser());
                    //cgm.Setup(new IncomingHosts());
                    //cgm.Setup(new ConfigWaiter());

                }

                //cgm.Setup(new CreateHash());
                cgm.Setup(new TopologyFinish());

                GetLocalDgm().Put("topology", new Dictionary<String, LinkedList<HostMessage>>());
                GetLocalDgm().Put("createdList", new LinkedList<String>());
            }
        }
    }
}