Mercurial > hg > Database > Alice
changeset 578:ffa43f252492 dispose
add getTailIndex
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 17 Dec 2015 15:57:04 +0900 |
parents | 924e5f52a61f |
children | 56e2397e6c78 |
files | src/main/java/alice/datasegment/DataSegmentKey.java src/main/java/alice/datasegment/LocalDataSegmentManager.java src/main/java/alice/topology/HostMessage.java src/main/java/alice/topology/manager/CreateTreeTopology.java src/main/java/alice/topology/manager/IncomingHosts.java src/main/java/alice/topology/manager/SearchHostName.java src/main/java/alice/topology/node/StartTopologyNode.java src/main/java/alice/topology/node/TopologyNode.java |
diffstat | 8 files changed, 27 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/datasegment/DataSegmentKey.java Wed Dec 16 17:28:12 2015 +0900 +++ b/src/main/java/alice/datasegment/DataSegmentKey.java Thu Dec 17 15:57:04 2015 +0900 @@ -85,7 +85,7 @@ } - public void replyValue(Command cmd, DataSegmentValue data, boolean cFlag){ + private void replyValue(Command cmd, DataSegmentValue data, boolean cFlag){ if (cFlag && !data.rData.compressed()){ try { data.rData.zip(); @@ -112,4 +112,9 @@ } } + public int getTailIndex(){ + return tailIndex; + } + + }
--- a/src/main/java/alice/datasegment/LocalDataSegmentManager.java Wed Dec 16 17:28:12 2015 +0900 +++ b/src/main/java/alice/datasegment/LocalDataSegmentManager.java Thu Dec 17 15:57:04 2015 +0900 @@ -142,6 +142,11 @@ logger.debug(cmd.getCommandString()); } + public int getDSindex(String key){ + DataSegmentKey dataSegmentKey = getDataSegmentKey(key); + return dataSegmentKey.getTailIndex(); + } + @Override public void ping(String returnKey) {
--- a/src/main/java/alice/topology/HostMessage.java Wed Dec 16 17:28:12 2015 +0900 +++ b/src/main/java/alice/topology/HostMessage.java Thu Dec 17 15:57:04 2015 +0900 @@ -6,6 +6,7 @@ public class HostMessage { public String name; public int port; + public int topMNum = 0;//複数のTopMに接続する際、どのTopMのノードかを識別する public String connectionName; public String absName; // this is absName which have these IP and port. @@ -17,9 +18,10 @@ public boolean alive; public HostMessage() { } - public HostMessage(String name, int port) { + public HostMessage(String name, int port, int topMNum) { this.name = name; this.port = port; + this.topMNum = topMNum; } public HostMessage(String name, int port, String connectionName, String reverseName) {
--- a/src/main/java/alice/topology/manager/CreateTreeTopology.java Wed Dec 16 17:28:12 2015 +0900 +++ b/src/main/java/alice/topology/manager/CreateTreeTopology.java Thu Dec 17 15:57:04 2015 +0900 @@ -42,6 +42,7 @@ String nodeName = "node"+comingHostCount; // Manager connect to Node DataSegment.connect(nodeName, nodeName, host.name, host.port); + //ods.put(nodeName, "host", new HashMap<Integer, String>().put(host.topMNum, nodeName)); ods.put(nodeName, "host", nodeName); ods.put(nodeName, "cookie", cookie);
--- a/src/main/java/alice/topology/manager/IncomingHosts.java Wed Dec 16 17:28:12 2015 +0900 +++ b/src/main/java/alice/topology/manager/IncomingHosts.java Thu Dec 17 15:57:04 2015 +0900 @@ -41,6 +41,7 @@ String nodeName = nodeNames.poll(); // Manager connect to Node DataSegment.connect(nodeName, "", host.name, host.port); + //ods.put(nodeName, "host", new HashMap<Integer, String>() .put(host.topMNum, nodeName)); ods.put(nodeName, "host", nodeName); String cookie = this.cookie.asString();
--- a/src/main/java/alice/topology/manager/SearchHostName.java Wed Dec 16 17:28:12 2015 +0900 +++ b/src/main/java/alice/topology/manager/SearchHostName.java Thu Dec 17 15:57:04 2015 +0900 @@ -32,6 +32,7 @@ DataSegment.remove(hostInfo.absName); DataSegment.connect(hostInfo.absName, "", hostInfo.name, hostInfo.port); + //ods.put(hostInfo.absName, "host", new HashMap<Integer, String>() .put(hostInfo.topMNum, hostInfo.absName)); ods.put(hostInfo.absName, "host", hostInfo.absName); // put Host dataSegment on reconnect node
--- a/src/main/java/alice/topology/node/StartTopologyNode.java Wed Dec 16 17:28:12 2015 +0900 +++ b/src/main/java/alice/topology/node/StartTopologyNode.java Thu Dec 17 15:57:04 2015 +0900 @@ -12,10 +12,12 @@ private TopologyNodeConfig conf; private CodeSegment startCS; + private int topMNumber; - public StartTopologyNode(TopologyNodeConfig conf, CodeSegment startCS) { + public StartTopologyNode(TopologyNodeConfig conf, CodeSegment startCS, int topMNum) { this.conf = conf; this.startCS = startCS; + this.topMNumber = topMNum; } @Override @@ -29,7 +31,7 @@ } new SaveCookie(); - HostMessage host = new HostMessage(localHostName, conf.localPort); + HostMessage host = new HostMessage(localHostName, conf.localPort, topMNumber); host.cookie = conf.cookie; ods.put("manager", "host", host);
--- a/src/main/java/alice/topology/node/TopologyNode.java Wed Dec 16 17:28:12 2015 +0900 +++ b/src/main/java/alice/topology/node/TopologyNode.java Thu Dec 17 15:57:04 2015 +0900 @@ -7,7 +7,12 @@ public TopologyNode(TopologyNodeConfig conf, CodeSegment startCS) { new AliceDaemon(conf).listen(); - new StartTopologyNode(conf, startCS).execute(); + new StartTopologyNode(conf, startCS, 0).execute(); + } + + public TopologyNode(TopologyNodeConfig conf, CodeSegment startCS, int TopMNumber) { + new AliceDaemon(conf).listen(); + new StartTopologyNode(conf, startCS, TopMNumber).execute(); } public static void main(String[] args) {