Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 341:7388d8606528
merger
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 28 Aug 2017 21:55:44 +0900 |
parents | 111e57d0b233 (current diff) 7d40ac7e693f (diff) |
children | a8794548f5c9 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/codesegment/LOgUpdateCodeSegment.java |
diffstat | 2 files changed, 55 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/codesegment/LOgUpdateCodeSegment.java Mon Aug 28 21:54:42 2017 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.jungleNetwork.codesegment; - -import alice.codesegment.CodeSegment; -import alice.datasegment.CommandType; -import alice.datasegment.Receiver; -import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; -import jp.ac.u_ryukyu.ie.cr.jungle.util.jungleError.Error; -import jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations.NetworkTreeOperationLog; - -import java.util.List; - -/** - * Created by kono on 2017/08/27. - */ -public class LogUpdateCodeSegment extends CodeSegment { - - Receiver log = ids.create(CommandType.TAKE); - Receiver clist = ids.create(CommandType.PEEK); - Receiver updator = ids.create(CommandType.TAKE); - - public LogUpdateCodeSegment() { - log.setKey("log"); - clist.setKey("_CLIST"); - updator.setKey("updator"); - } - - public LogUpdateCodeSegment(int index) { - log.setKey("log", index); - clist.setKey("_CLIST");; - updator.setKey("updator"); - } - - public void run() { - int index = log.index; - new LogUpdateCodeSegment(); - NetworkTreeOperationLog netLog = log.asClass(NetworkTreeOperationLog.class); - @SuppressWarnings("unchecked") - List<String> list = clist.asClass(List.class); - for (String node : list) { - if (!node.equals(log.from)) { - ods.put(node, log.key, log.getVal()); - } - } - JungleDistributedUpdator u = updator.asClass(JungleDistributedUpdator.class); - if (!log.from.equals("local")) { - Either<Error, JungleTreeEditor> either = u.update(netLog); - if(either.isA()) { - new LogUpdateCodeSegment(index); - throw new IllegalStateException(); - } - } - ods.put("updator",u); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/codesegment/LogUpdateCodeSegment.java Mon Aug 28 21:55:44 2017 +0900 @@ -0,0 +1,55 @@ +package jp.ac.u_ryukyu.ie.cr.jungleNetwork.codesegment; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.editor.jungleTreeEditor.JungleTreeEditor; +import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.jungleError.Error; +import jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations.NetworkTreeOperationLog; + +import java.util.List; + +/** + * Created by kono on 2017/08/27. + */ +public class LogUpdateCodeSegment extends CodeSegment { + + Receiver log = ids.create(CommandType.TAKE); + Receiver clist = ids.create(CommandType.PEEK); + Receiver updator = ids.create(CommandType.TAKE); + + public LogUpdateCodeSegment() { + log.setKey("log"); + clist.setKey("_CLIST"); + updator.setKey("updator"); + } + + public LogUpdateCodeSegment(int index) { + log.setKey("log", index); + clist.setKey("_CLIST");; + updator.setKey("updator"); + } + + public void run() { + int index = log.index; + new LogUpdateCodeSegment(); + NetworkTreeOperationLog netLog = log.asClass(NetworkTreeOperationLog.class); + @SuppressWarnings("unchecked") + List<String> list = clist.asClass(List.class); + for (String node : list) { + if (!node.equals(log.from)) { + ods.put(node, log.key, log.getVal()); + } + } + JungleDistributedUpdator u = updator.asClass(JungleDistributedUpdator.class); + if (!log.from.equals("local")) { + Either<Error, JungleTreeEditor> either = u.update(netLog); + if(either.isA()) { + new LogUpdateCodeSegment(index); + throw new IllegalStateException(); + } + } + ods.put("updator",u); + } +}