Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 338:7a7d5d175c0c
add CodeSegment for Network
updator
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 28 Aug 2017 12:17:11 +0900 |
parents | c90d9c64aeda |
children | 7d40ac7e693f 111e57d0b233 |
files | .idea/gradle.xml .idea/modules.xml .idea/vcs.xml build.gradle jungle-core.iml src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/codesegment/JungleDistributedUpdator.java src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/codesegment/LOgUpdateCodeSegment.java src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkDefaultJungleTreeEditor.java |
diffstat | 8 files changed, 81 insertions(+), 153 deletions(-) [+] |
line wrap: on
line diff
--- a/.idea/gradle.xml Tue Aug 08 18:15:27 2017 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="GradleSettings"> - <option name="linkedExternalProjectsSettings"> - <GradleProjectSettings> - <option name="distributionType" value="DEFAULT_WRAPPED" /> - <option name="externalProjectPath" value="$PROJECT_DIR$/../Alice" /> - <option name="gradleHome" value="/usr/local/share/gradle" /> - <option name="modules"> - <set> - <option value="$PROJECT_DIR$/../Alice" /> - </set> - </option> - <option name="myModules"> - <set> - <option value="$PROJECT_DIR$/../Alice" /> - </set> - </option> - </GradleProjectSettings> - <GradleProjectSettings> - <option name="distributionType" value="DEFAULT_WRAPPED" /> - <option name="externalProjectPath" value="$PROJECT_DIR$" /> - <option name="gradleHome" value="/usr/local/share/gradle" /> - <option name="gradleJvm" value="1.8" /> - <option name="modules"> - <set> - <option value="$PROJECT_DIR$" /> - </set> - </option> - <option name="myModules"> - <set> - <option value="$PROJECT_DIR$" /> - </set> - </option> - </GradleProjectSettings> - </option> - </component> -</project> \ No newline at end of file
--- a/.idea/modules.xml Tue Aug 08 18:15:27 2017 +0900 +++ b/.idea/modules.xml Mon Aug 28 12:17:11 2017 +0900 @@ -2,8 +2,12 @@ <project version="4"> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/../Alice/Alice.iml" filepath="$PROJECT_DIR$/../Alice/Alice.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/Alice.iml" filepath="$PROJECT_DIR$/.idea/modules/Alice.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/Alice_main.iml" filepath="$PROJECT_DIR$/.idea/modules/Alice_main.iml" group="Alice" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/Alice_test.iml" filepath="$PROJECT_DIR$/.idea/modules/Alice_test.iml" group="Alice" /> <module fileurl="file://$PROJECT_DIR$/jungle-core.iml" filepath="$PROJECT_DIR$/jungle-core.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/jungle-core_main.iml" filepath="$PROJECT_DIR$/.idea/modules/jungle-core_main.iml" group="jungle-core" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/jungle-core_test.iml" filepath="$PROJECT_DIR$/.idea/modules/jungle-core_test.iml" group="jungle-core" /> </modules> </component> </project> \ No newline at end of file
--- a/.idea/vcs.xml Tue Aug 08 18:15:27 2017 +0900 +++ b/.idea/vcs.xml Mon Aug 28 12:17:11 2017 +0900 @@ -3,8 +3,6 @@ <component name="VcsDirectoryMappings"> <mapping directory="" vcs="hg4idea" /> <mapping directory="$PROJECT_DIR$/../Alice" vcs="hg4idea" /> - <mapping directory="$PROJECT_DIR$/../Alice" vcs="hg4idea" /> - <mapping directory="$PROJECT_DIR$" vcs="hg4idea" /> <mapping directory="$PROJECT_DIR$" vcs="hg4idea" /> </component> </project> \ No newline at end of file
--- a/build.gradle Tue Aug 08 18:15:27 2017 +0900 +++ b/build.gradle Mon Aug 28 12:17:11 2017 +0900 @@ -21,8 +21,8 @@ compile group: 'com.google.guava', name: 'guava', version: '20.0' compile fileTree(dir: 'lib', include: '*.jar') compile group: 'junit', name: 'junit', version: '4.11' -// compile group: 'cr.ie.u_ryukyu.ac.jp', name: 'Alice', version: '1.1', ext: 'jar' - compile group: 'org.msgpack', name: 'msgpack', version: '0.6.0' + compile group: 'cr.ie.u_ryukyu.ac.jp', name: 'Alice', version: '1.1', ext: 'jar' + compile group: 'org.msgpack', name: 'msgpack', version: '0.6.12' } jar { @@ -34,7 +34,7 @@ } ext { - mavenRepository = System.getenv()['HTML']+'/maven' + mavenRepository = System.getenv()['CRMAVEN']+'/maven' }
--- a/jungle-core.iml Tue Aug 08 18:15:27 2017 +0900 +++ b/jungle-core.iml Mon Aug 28 12:17:11 2017 +0900 @@ -1,118 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id="jungle-core" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="cr.ie.u_ryukyu.ac.jp" external.system.module.version="1.0" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/build/classes/main" /> - <output-test url="file://$MODULE_DIR$/build/classes/test" /> +<module external.linked.project.id="jungle-core" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="cr.ie.u_ryukyu.ac.jp" external.system.module.version="1.1" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> <exclude-output /> <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> <excludeFolder url="file://$MODULE_DIR$/.gradle" /> <excludeFolder url="file://$MODULE_DIR$/build" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module-library"> - <library name="Gradle: commons-collections:commons-collections:3.2.1"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-collections/commons-collections/3.2.1/761ea405b9b37ced573d2df0d1e3a4e0f9edc668/commons-collections-3.2.1.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-collections/commons-collections/3.2.1/fa095ef874374e5b2a11f8b06c26a5d68c7cb3a4/commons-collections-3.2.1-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.apache.maven.surefire:surefire-junit4:2.13"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.maven.surefire/surefire-junit4/2.13/d2a35c1d9af8b40905d6d0cb2c5dc8ff748f8589/surefire-junit4-2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.maven.surefire/surefire-junit4/2.13/fcbb7062f412c1450d86709cb67c4b9261652170/surefire-junit4-2.13-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: com.google.guava:guava:20.0"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/20.0/89507701249388e1ed5ddcf8c41f4ce1be7831ef/guava-20.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/20.0/9c8493c7991464839b612d7547d6c263adf08f75/guava-20.0-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: junit:junit:4.11"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/28e0ad201304e4a4abf999ca0570b7cffc352c3c/junit-4.11-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.msgpack:msgpack:0.6.12"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.msgpack/msgpack/0.6.12/6a0c88fe022993c490011c3dce7127b29f9a9b3b/msgpack-0.6.12.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.msgpack/msgpack/0.6.12/d884987a52e47f566c6356ce948edbf546616072/msgpack-0.6.12-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.apache.maven.surefire:surefire-api:2.13"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.maven.surefire/surefire-api/2.13/4b0223fb338f7f875662497203e9812654e3255c/surefire-api-2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.maven.surefire/surefire-api/2.13/4a1791d8f4e73c797c165e0a11a284a56638675a/surefire-api-2.13-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.hamcrest:hamcrest-core:1.3"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: com.googlecode.json-simple:json-simple:1.1.1"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/c9ad4a0850ab676c5c64461a05ca524cdfff59f1/json-simple-1.1.1.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/15bba08e3a239d54b68209c001f9c911559d2fed/json-simple-1.1.1-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.javassist:javassist:3.18.1-GA"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.18.1-GA/d9a09f7732226af26bf99f19e2cffe0ae219db5b/javassist-3.18.1-GA.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.18.1-GA/d8d089f3a8845cce22d3006e02ab1403dd73b5b6/javassist-3.18.1-GA-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module" module-name="Alice" /> </component> </module> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/codesegment/JungleDistributedUpdator.java Mon Aug 28 12:17:11 2017 +0900 @@ -0,0 +1,15 @@ +package jp.ac.u_ryukyu.ie.cr.jungleNetwork.codesegment; + +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; + +/** + * Created by kono on 2017/08/28. + */ + + +public interface JungleDistributedUpdator { + Either<Error, JungleTreeEditor> update(NetworkTreeOperationLog netLog); +} \ No newline at end of file
--- /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 12:17:11 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); + } +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkDefaultJungleTreeEditor.java Tue Aug 08 18:15:27 2017 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/transaction/NetworkDefaultJungleTreeEditor.java Mon Aug 28 12:17:11 2017 +0900 @@ -18,8 +18,8 @@ import jp.ac.u_ryukyu.ie.cr.jungle.transaction.node.TreeNode; import jp.ac.u_ryukyu.ie.cr.jungle.util.DefaultEither; import jp.ac.u_ryukyu.ie.cr.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.jungle.util.IterableConverter; import jp.ac.u_ryukyu.ie.cr.jungle.util.jungleError.Error; -import jp.ac.u_ryukyu.ie.cr.jungle.util.IterableConverter; import jp.ac.u_ryukyu.ie.cr.jungleNetwork.codesegment.LogPutCodeSegment; import jp.ac.u_ryukyu.ie.cr.jungleNetwork.operations.NetworkTreeOperationLog;