changeset 58:0d2c956060d8

add topology manager
author KaitoMaeshiro <aosskaito@cr.ie.u-ryukyu.ac.jp>
date Tue, 25 Jan 2022 22:35:25 +0900
parents 3d46515f3887
children c4f8630b7822
files Test/Example/Aquarium/StartAquarium.cs Test/Example/Fibonacci/FibonacchiCodeGear.cs Test/Example/Fibonacci/StartFibonacchi.cs Test/Topology/TreeTestTopology/StartTreeTestTopology.cs Test/Topology/TreeTestTopology/tartTreeTestTopology.cs topology/HostMessage.cs topology/Massage.cs topology/TopologyDataGear.cs topology/manager/CheckComingHost.cs topology/manager/CreateTreeTopology.cs topology/manager/Parent.cs topology/manager/ParentManager.cs topology/manager/RecordTopology.cs topology/manager/SearchHostName.cs topology/manager/StartTopologyManager.cs topology/manager/TopologyManager.cs topology/manager/TopologyManagerConfig.cs topology/manager/TopologyType.cs topology/node/Start.cs
diffstat 18 files changed, 777 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Example/Aquarium/StartAquarium.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,41 @@
+/*using System;
+using System.Threading;
+using Christie_net.annotation;
+using Christie_net.codegear;
+
+namespace Christie_net.Test.Example.Aquarium {
+
+    public class StartAquarium : StartCodeGear {
+        public static void Main(String args){
+            CodeGearManager conf = CreateCgm(10000);
+            
+            CodeGearManager cs = CreateCgm(10001);
+            if (conf.getManagerHostName() !=null){
+                cs.ods.put("type", conf.type);
+                new TopologyNode(conf, cs);
+            } else {
+                cs.ods.put("host", "local0");
+                cs.execute();
+            }
+            
+            
+            
+            
+            AquariumConfig conf = new AquariumConfig(args);
+            conf.register(GetMyHostName.class);
+            StartCodeSegment cs = new StartCodeSegment();
+            if (conf.getManagerHostName() !=null){
+                cs.ods.put("type", conf.type);
+                new TopologyNode(conf, cs);
+            } else {
+                cs.ods.put("host", "local0");
+                cs.execute();
+            }
+            
+            
+            
+        }
+    }
+    
+}
+*/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Example/Fibonacci/FibonacchiCodeGear.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,28 @@
+using System;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.Test.Example.RemoteTake;
+
+namespace Christie_net.Test.Example.Fibonacci {
+    public class FibonacciCodeGear : CodeGear {
+        [Take] public int num1;
+        [Take] public int num2;
+    
+        public override void Run(CodeGearManager cgm)
+        {
+            int i = num1 + num2;
+            
+            Console.WriteLine(num1);
+            GetLocalDgm().Put("num1",num2);
+            GetLocalDgm().Put("num2",i);
+
+            i = num1 + num2;
+
+            if (num1 <= 50) {
+                cgm.Setup(new FibonacciCodeGear());
+            } else {
+                cgm.GetLocalDGM().Finish();
+            }
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Example/Fibonacci/StartFibonacchi.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,21 @@
+using System;
+using System.Threading;
+using Christie_net.annotation;
+using Christie_net.codegear;
+
+namespace Christie_net.Test.Example.Fibonacci {
+    
+    public class StartFibonacci : StartCodeGear {
+
+        public StartFibonacci(CodeGearManager cgm) : base(cgm) { }
+
+        public static void Main(string[] args) {
+            CodeGearManager cgm = CreateCgm(10000);
+            
+            cgm.Setup(new FibonacciCodeGear());
+            cgm.GetLocalDGM().Put("num1", 0);
+            cgm.GetLocalDGM().Put("num2", 1);
+            
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Topology/TreeTestTopology/tartTreeTestTopology.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,4 @@
+using System;
+using System.Threading;
+using Christie_net.annotation;
+using Christie_net.codegear;
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/HostMessage.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,85 @@
+using System;
+using System.Net;
+using System.Collections.Generic;
+
+
+namespace Christie_net.topology.HostMessage {
+    public class HostMessage /*: Cloneable*/ {
+        private String hostName = "";
+    private int port ;
+    private String nodeName; // this is nodeName which have these IP and port.
+    private String connectionName;
+    private String remoteNodeName;
+
+    private String cookie; // MD5
+
+    private Boolean alive;
+
+    public HostMessage() {}
+
+    public void setLocalHostAndPort(int port){
+        try {
+            hostName = InetAddress.getLocalHost().getHostAddress();
+            this.port = port;
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void setHostAndPort(HostMessage hostMessage) {
+        setHostAndPort(hostMessage.getHostName(), hostMessage.getPort());
+    }
+
+    public void setHostAndPort(String hostName, int port) {
+        this.hostName = hostName;
+        this.port = port;
+    }
+
+    public void setNodeInfo(String nodeName, String connectionName, String remoteNodeName){
+        this.nodeName = nodeName;
+        this.connectionName = connectionName;
+        this.remoteNodeName = remoteNodeName;
+    }
+
+    public void setNodeName(String nodeName) {
+        this.nodeName = nodeName;
+    }
+
+    public String getHostName() { return hostName; }
+
+    public int getPort() { return port; }
+
+    public String getNodeName() { return nodeName; }
+
+    public String getConnectionName() { return connectionName; }
+
+    public String getRemoteNodeName() { return remoteNodeName; }
+
+    public void setAlive(Boolean alive) { this.alive = alive; }
+
+    public Boolean isAlive() { return alive; }
+
+    public void setCookie(String cookie) { this.cookie = cookie; }
+
+    public String getCookie() { return cookie; }
+
+    public String toString() {
+        return "HostMessage : name = " + hostName + ", port = " + Convert.ToInt32(port) + " connectionName = " +
+                connectionName + " nodeName = " + nodeName + " remoteNodeName = " + remoteNodeName
+                + " cokkie = " + cookie ;
+    }
+
+    /*
+    public HostMessage clone(){
+
+        HostMessage cloneHostMessage = new HostMessage();
+        try {
+            cloneHostMessage = (HostMessage)super.clone();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return cloneHostMessage;
+    }
+    */
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/Massage.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,9 @@
+using System;
+
+namespace Christie_net.topology {
+    public class Message : Attribute {
+        public Message(){
+
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/TopologyDataGear.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,56 @@
+using System;
+using System.Net;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace Christie_net.topology.TopologyDataGear {
+    
+    public class TopologyDataGear /*: Cloneable*/{
+    String nodeName;
+    int totalNodeNum;
+    //List<String> connectionList = new ArrayList<>();
+    List<String> connectionList = new List<String>();
+
+
+    public TopologyDataGear(){}
+
+    public void setNodeName(String nodeName) {
+        this.nodeName = nodeName;
+    }
+
+    public String getNodeName() {
+        return nodeName;
+    }
+
+    public void setTotalNodeNum(int totalNodeNum) {
+        this.totalNodeNum = totalNodeNum;
+    }
+
+    public int getTotalNodeNum() {
+        return totalNodeNum;
+    }
+
+    public void addConnection(String connectionName) {
+        this.connectionList.Add(connectionName);
+    }
+
+    public List<String> getConnectionList() {
+        return connectionList;
+    }
+
+    
+    
+    /*
+    public TopologyDataGear clone(){
+
+        TopologyDataGear cloneTopoDG = new TopologyDataGear();
+        try {
+            cloneTopoDG = (TopologyDataGear)super.clone();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return cloneTopoDG;
+    }
+    */
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/CheckComingHost.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.topology;
+
+namespace Christie_net.topology.manager.CheckComingHost
+{
+    public class CheckComingHost : CodeGear
+    {
+        [Take] public HostMessage hostMessage;
+        [Peek] public Dictionary<String, String> absCookieTable;
+
+        public CheckComingHost()
+        {
+        }
+
+        public override void Run(CodeGearManager cgm)
+        {
+
+            String cookie = hostMessage.getCookie();
+            // check cookie
+            if (cookie != null)
+            {
+                if (absCookieTable.ContainsKey(cookie))
+                {
+                    hostMessage.setNodeName(cookie);
+                    Console.WriteLine("match");
+                    // coming host has ever joined this App
+                    GetLocalDgm().Put("reconnectHost", hostMessage);
+                    cgm.Setup(new SearchHostName.SearchHostName());
+                }
+            }
+            else
+            {
+                GetLocalDgm().Put("orderHash", "order");
+                GetLocalDgm().Put("newHost", hostMessage);
+            }
+
+            cgm.Setup(new CheckComingHost());
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/CreateTreeTopology.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using Christie_net.daemon;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.topology;
+
+
+namespace Christie_net.topology.manager.CreateTreeTopology {
+
+    public class CreateTreeTopology : CodeGear {
+        [Take] public HostMessage.HostMessage newHost;
+        [Take] public int hostCount;
+        [Take] public Dictionary<String, HostMessage.HostMessage> nameTable;
+        [Take] public String MD5;
+        [Take] public Dictionary<String, String> absCookieTable;
+        [Take] public ParentManager.ParentManager parentManager;
+
+        public CreateTreeTopology()
+        {
+        }
+
+        public override void Run(CodeGearManager cgm)
+        {
+            String nodeName = "node" + hostCount;
+        String newHostName = newHost.getHostName();
+        int newHostPort = newHost.getPort();
+
+        cgm.CreateRemoteDGM(nodeName, newHostName, newHostPort);
+
+        TopologyDataGear.TopologyDataGear topoDG = new TopologyDataGear.TopologyDataGear();
+        topoDG.setNodeName(nodeName);
+
+        GetDgm(nodeName).Put("topoDG", topoDG);
+        GetDgm(nodeName).Put("cookie", MD5);
+
+        absCookieTable.put(MD5, nodeName);
+        GetLocalDgm().Put("absCookieTable", absCookieTable);
+
+        GetLocalDgm().Put("hostCount", hostCount + 1);
+        newHost.setAlive(true);
+        nameTable.put(nodeName, newHost);
+        parentManager.register(nodeName);
+
+        if (hostCount == 0) {
+            // どこにも繋がれるところがないので, ルートのとき.
+        } else {
+            // put parent information own
+            String parentNodeName = parentManager.getMyParent();
+            HostMessage.HostMessage parentHost = nameTable.get(parentNodeName).clone();
+
+
+            // 相手からhostNameとportはもらっているので, nodeの情報だけ与えれば良い.
+            parentHost.setNodeInfo(nodeName, "parent", parentNodeName);
+            //parentHost.setNodeInfo(parentNodeName, "child", nodeName);
+            GetLocalDgm().Put("nodeInfo", parentHost);
+            GetDgm(nodeName).Put("remoteNodeInfo", parentHost);
+            cgm.Setup(new RecordTopology());
+
+            // newChildHost, newHostも同じ
+            newHost.setNodeInfo(parentNodeName, "child" + parentManager.getMyNumber(), nodeName);
+            GetLocalDgm().Put("nodeInfo", newHost);
+            GetDgm(parentNodeName).Put("remoteNodeInfo", newHost);
+            cgm.Setup(new RecordTopology());
+        }
+
+        GetLocalDgm().Put("nameTable", nameTable);
+        GetLocalDgm().Put("parentManager", parentManager);
+
+        GetDgm(nodeName).Put("connectNodeNum", 1);
+        //getDGM(nodeName).put("remoteNodeInfo", new HostMessage());
+        GetDgm(nodeName).Put("_CONNECTIONMESSAGE", new Message());
+        GetDgm(nodeName).Put("_STARTMESSAGE", new Message());
+        GetLocalDgm().Put("startTime", System.currentTimeMillis());
+
+        cgm.Setup(new CreateTreeTopology());
+
+
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/Parent.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+
+namespace Christie_net.topology.manager.Parent
+{
+    public class Parent
+    {
+        private String name;
+    private int childrens = 0;
+
+    public Parent(String name) {
+        this.name = name;
+    }
+
+    public int children() {
+        return childrens;
+    }
+
+    public void setChildren(int num) {
+        childrens = num;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String n) {
+        name = n;
+    }
+
+    public void increment() {
+        childrens++;
+    }
+
+    public void decrement() {
+        childrens--;
+    }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/ParentManager.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.topology;
+
+namespace Christie_net.topology.manager.ParentManager
+{
+    public class ParentManager
+    {
+        private int maxChildren;
+        private int position = 0;
+        private LinkedList<Parent.Parent> list;
+        public ParentManager(int hasChildren){
+            list = new LinkedList<Parent.Parent>();
+            maxChildren = hasChildren;
+        }
+
+        public String getMyParent() {
+            checkChildNumber();
+            return list.get(position).getName();
+        }
+
+        public int getMyNumber() {
+            checkChildNumber();
+            int num = list.get(position).children();
+            list.get(position).increment();
+            return num;
+        }
+
+        private void checkChildNumber() {
+            for (;;next()) {
+                if (list.get(position).children() < maxChildren)
+                    break;
+            }
+        }
+
+        public void register(String name) {
+            Parent.Parent p = new Parent.Parent(name);
+            list.AddLast(p);
+        }
+
+        public void next() {
+            position++;
+        }
+
+        public void previous() {
+            position--;
+        }
+
+        public void replaceAndRemove(String remove, String replace) {
+            Parent.Parent removeNode = find(remove);
+            Remove(replace);
+            removeNode.setName(replace);
+        }
+
+        public void remove(String remove) {
+            Parent.Parent removeNode = find(remove);
+            list.Remove(removeNode);
+        }
+
+        public Parent.Parent find(String name) {
+            Boolean found = false;
+            int i = 0;
+            for (;i<list.Count;i++) {
+                if (list.get(i).getName().equals(name)) {
+                    found = true;
+                    break;
+                }
+            }
+            if (found) {
+                return list.get(i);
+            } else {
+                return null;
+            }
+        }
+
+        public Parent.Parent getLastNode(){
+            return list.get();
+        }
+
+        public void show() {
+            int counter = 0;
+            Console.WriteLine("| ");
+            foreach (Parent.Parent p in list) {
+                if (counter==position)
+                    Console.WriteLine("P ");
+                Console.WriteLine(p.getName()+" "+p.children()+" | ");
+                counter++;
+            }
+        }
+
+        public LinkedList<Parent.Parent> getList() {
+            return list;
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/RecordTopology.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using Christie_net.daemon;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.topology;
+
+
+namespace Christie_net.topology.manager.RecordTopology {
+
+    public class CreateTreeTopology : CodeGear {
+        [Take] public HostMessage.HostMessage nodeInfo;
+        [Take] public Dictionary<String, LinkedList<HostMessage.HostMessage>> topology;
+        
+        public override void Run(CodeGearManager cgm){
+            String nodeName = nodeInfo.getNodeName();
+
+            LinkedList<HostMessage.HostMessage> connections;
+
+            if (!topology.ContainsKey(nodeName)) {
+                connections = new LinkedList<HostMessage.HostMessage>();
+            } else {
+                connections = topology.get(nodeName);
+            }
+            connections.add(nodeInfo);
+            topology.put(nodeName, connections);
+
+            GetLocalDgm().Put("topology", topology);
+
+        }
+        
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/SearchHostName.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.topology;
+
+namespace Christie_net.topology.manager.SearchHostName {
+
+    public class SearchHostName : CodeGear
+    {
+        [Take] public HostMessage.HostMessage reconnectHost;
+        [Peek] public Dictionary<String, LinkedList<HostMessage.HostMessage>> topology;
+        [Peek] public Boolean running;
+        
+        public SearchHostName(){
+        }
+
+        public override void Run(CodeGearManager cgm)
+        {
+            // Question: remove処理 どうしようか. いらない気もする.
+            // DataSegment.remove(hostInfo.absName);
+
+            String nodeName = reconnectHost.getNodeName();
+            String hostName = reconnectHost.getHostName();
+            int port = reconnectHost.getPort();
+
+            cgm.CreateRemoteDGM(nodeName, hostName, port);
+            GetDgm(nodeName).Put("nodeName", nodeName);
+
+            // put Host dataSegment on reconnect node
+            if (topology.ContainsKey(nodeName))
+            {
+
+                // Question: これはバグ...?
+                // ods.put(reconnectHost.absName, "dummy"); // this is bug
+
+                if (running)
+                {
+                    GetLocalDgm().Put(nodeName, "");
+                }
+
+
+                LinkedList<HostMessage.HostMessage> hostList = topology.get(nodeName);
+                foreach (HostMessage.HostMessage host in hostList)
+                {
+                    GetLocalDgm().Put(nodeName, host);
+                    Console.WriteLine("put data in " + nodeName);
+                }
+            }
+            
+            // update topology information
+            foreach (LinkedList<HostMessage.HostMessage> list in topology.Values){
+                foreach (HostMessage.HostMessage host in list){
+
+                    // find and update old info
+                    if (!nodeName.Equals(host.getNodeName())) continue;
+
+                    if (!hostName.Equals(host.getHostName()) || port != host.getPort()){
+                        host.setHostAndPort(hostName, port);
+
+                        GetLocalDgm().Put(host.getNodeName(), host);
+
+                    } else {
+                        // nothing to do ?
+                    }
+                }
+            }
+
+            foreach (LinkedList<HostMessage.HostMessage> list in topology.Values)
+            {
+                Console.WriteLine(list.get(0).getRemoteNodeName() + " : ");
+                foreach (HostMessage.HostMessage host in list)
+                {
+                    Console.WriteLine("[ " + host.getNodeName() + " "
+                                      + host.getHostName() + " "
+                                      + host.getPort() + " "
+                                      + host.getConnectionName() + " "
+                                      + host.getRemoteNodeName() + " ]");
+                }
+
+                Console.WriteLine();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/StartTopologyManager.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,40 @@
+using System;
+using System.Threading;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.topology.node.Start;
+using Christie_net.topology.manager;
+
+namespace Christie_net.topology.manager.StartTopologyManager {
+    
+    public class StartTopologyManager : StartCodeGear {
+        public StartTopologyManager(string[] args) : this(CreateCgm(new TopologyManagerConfig.TopologyManagerConfig(args).localPort), new TopologyManagerConfig.TopologyManagerConfig(args)){
+        }
+        public StartTopologyManager(TopologyManagerConfig.TopologyManagerConfig topologyManagerConfig) : this(CreateCgm(topologyManagerConfig.localPort), topologyManagerConfig){
+        }
+        
+        public StartTopologyManager(CodeGearManager cgm, TopologyManagerConfig.TopologyManagerConfig topologyManagerConfig) : base(cgm) {
+            cgm.Setup(new TopologyManager.TopologyManager());
+            cgm.GetLocalDGM().Put("topologyManagerConfig", topologyManagerConfig);
+        }
+        
+        public StartTopologyManager(TopologyManagerConfig.TopologyManagerConfig conf, CodeGear startCG) :this(CreateCgm(conf.localPort), conf, startCG){
+
+        }
+
+        public StartTopologyManager(CodeGearManager cgm, TopologyManagerConfig.TopologyManagerConfig conf, CodeGear startCG) : base(cgm) {
+            cgm.Setup(new TopologyManager.TopologyManager());
+            cgm.Setup(new Start());
+            cgm.GetLocalDGM().Put("startCG", startCG);
+            cgm.GetLocalDGM().Put("topologyNodeConfig", conf);
+
+        }
+        
+        
+        
+        public static void Main(string[] args) {
+            TopologyManagerConfig.TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig.TopologyManagerConfig(args);
+            new StartTopologyManager(topologyManagerConfig);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/TopologyManager.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using Christie_net.daemon;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.topology;
+
+
+namespace Christie_net.topology.manager.TopologyManager {
+
+    public class TopologyManager : CodeGear {
+        [Peek] public TopologyManagerConfig.TopologyManagerConfig topologyManagerConfig;
+        
+        public TopologyManager() {
+        }
+
+        public override void Run(CodeGearManager cgm) {
+            cgm.Setup(new CheckComingHost.CheckComingHost());
+            GetLocalDgm().Put("absCookieTable", new Dictionary<String, String>());
+            
+            if(topologyManagerConfig.dynamic) {
+                GetLocalDgm().Put("running", true);
+                GetLocalDgm().Put("_STARTMESSAGE", new Message());
+
+                if (topologyManagerConfig.type == TopologyType.TopologyType.Tree) {
+                    GetLocalDgm().Put("parentManager", new ParentManager.ParentManager(topologyManagerConfig.hasChild));
+                    GetLocalDgm().Put("nameTable", new Dictionary<String, HostMessage.HostMessage>());
+                    GetLocalDgm().Put("hostCount", 0);
+                    cgm.Setup(new CreateTreeTopology.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.HostMessage>>());
+                GetLocalDgm().Put("createdList", new LinkedList<String>());
+
+            }
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/TopologyManagerConfig.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,36 @@
+using System;
+using System.Threading;
+using Christie_net.daemon;
+using Christie_net.topology;
+
+namespace Christie_net.topology.manager.TopologyManagerConfig {
+
+    public class TopologyManagerConfig : Config{
+        public Boolean showTime = false;
+        public String confFilePath;
+        public Boolean dynamic = false;
+        public TopologyType.TopologyType type = TopologyType.TopologyType.Tree;
+        public int hasChild = 2;
+
+        public TopologyManagerConfig(String[] args) /*: base(args)*/ {
+            for (int i = 0; i < args.Length; i++) {
+                if ("--confFile".Equals(args[i])) {
+                    confFilePath = args[++i];
+                } else if ("--topology".Equals(args[i])) {
+                    String typeName = args[++i];
+                    if ("tree".Equals(typeName))
+                    {
+                        type = TopologyType.TopologyType.Tree;
+                    }
+                } else if ("--child".Equals(args[i])) {
+                    hasChild = int.Parse(args[++i]);
+                } else if ("--showTime".Equals(args[i])) {
+                    showTime = true;
+                }
+            }
+
+            if (confFilePath == null) dynamic = true;
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/manager/TopologyType.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,9 @@
+using System;
+using System.Threading;
+
+namespace Christie_net.topology.manager.TopologyType {
+    
+    public enum TopologyType {
+        Tree = 1
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/topology/node/Start.cs	Tue Jan 25 22:35:25 2022 +0900
@@ -0,0 +1,22 @@
+using System;
+using System.Threading;
+using Christie_net.annotation;
+using Christie_net.codegear;
+using Christie_net.topology;
+
+namespace Christie_net.topology.node.Start {
+    
+    public class Start : CodeGear
+    {
+        [Peek] public Message _STARTMESSAGE;
+        [Take] public CodeGear startCG;
+        
+        public Start() {
+        }
+
+        public override void Run(CodeGearManager cgm) {
+            if (startCG == null) return;
+            cgm.Setup(startCG);
+        }
+    }
+}
\ No newline at end of file