initial draft of cassandra storage

This commit is contained in:
Jonas Boner 2009-04-19 10:58:20 +02:00
parent cd1ef83e49
commit 88c891ad1e
49 changed files with 1613 additions and 993 deletions

View file

@ -14,10 +14,56 @@
<orderEntry type="library" name="scala-2.7.3.final" level="application" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="util-java" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/voldemort-0.4a.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/stringtemplate-3.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/configgy-1.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/scala-library-2.7.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/zookeeper-3.1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-collections-3.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/libthrift-20080411p1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -35,7 +81,16 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/slf4j-api-1.4.3.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/colt-1.2.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/aopalliance-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -50,6 +105,96 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-pool-1.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/activation-1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-dbcp-1.2.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/libfb303.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jersey-server-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-portunif-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/slf4j-log4j12-1.4.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/voldemort-0.4a.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/asm-3.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/je-3.3.62.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
@ -62,7 +207,115 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/servlet-api-2.5.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/scalatest-0.9.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/lucene-core-2.2.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/stax-api-1.0-2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/protobuf-java-2.0.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/junit-3.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jetty-6.1.6rc0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-rcm-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-http-servlet-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/scalatest-0.9.5.zip!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jdom-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jersey-json-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-lang-2.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-javaflow-1.0-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -80,7 +333,106 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/asm-3.1.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/slf4j-api-1.4.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jettison-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/servlet-api-2.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/rome-0.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/guice-jsr250-2.0-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-cli-1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/cassandra.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jetty-util-6.1.6rc0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/JSAP-2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/velocity-1.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jersey-atom-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jaxb-api-2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -107,70 +459,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/velocity-1.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/rome-0.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jsr250-api-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/aopalliance-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-logging.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/guice-jsr250-2.0-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/scalatest-0.9.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/google-collect-snapshot-20090211.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/jersey-core-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -188,7 +477,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-http-1.8.6.3.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/high-scale-lib.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -197,295 +486,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-portunif-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-codec-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/voldemort-contrib-0.4a.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/xerces.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-lang-2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/scala-library-2.7.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jersey-atom-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jdom-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/stax-api-1.0-2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jaxb-api-2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/activation-1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jersey-json-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/je-3.3.62.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/slf4j-log4j12-1.4.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/configgy-1.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-rcm-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/cglib-2.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-http-servlet-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-collections-3.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jetty-util-6.1.6rc0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jettison-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-pool-1.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/zookeeper-3.1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/catalina-ant.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/libthrift-20080411p1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-servlet-webserver-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/junit4runner-1.0-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jersey-core-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/junit-3.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/scala-library-2.7.3.zip!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/log4j-1.2.13.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jersey-server-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/mina-integration-scala-2.0.0-M2-SNAPSHOT.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/jsr250-api-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -503,7 +504,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/scalatest-0.9.5.zip!/" />
<root url="jar://$MODULE_DIR$/../lib/google-collect-snapshot-20090211.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -512,7 +513,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-dbcp-1.2.2.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/mina-integration-scala-2.0.0-M2-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -521,7 +522,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/colt-1.2.0.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/libthrift.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -530,7 +531,52 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/protobuf-java-2.0.3.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/voldemort-contrib-0.4a.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/pcj.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/junit4runner-1.0-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/asm-all-2.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-logging-1.0.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/scala-library-2.7.3.zip!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@ -548,13 +594,84 @@
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/jetty-6.1.6rc0.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/xerces.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-http-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/log4j-1.2.15.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-codec-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/cglib-2.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/commons-math-1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/grizzly-servlet-webserver-1.8.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/catalina-ant.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/antlr-3.1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module" module-name="util-java" />
</component>
</module>

View file

@ -20,18 +20,24 @@ dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.activation-1.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\activation-1.1.jar
file.reference.akka-util-java.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\akka-util-java.jar
file.reference.antlr-3.1.3.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\antlr-3.1.3.jar
file.reference.aopalliance-1.0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\aopalliance-1.0.jar
file.reference.asm-3.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\asm-3.1.jar
file.reference.asm-all-2.2.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\asm-all-2.2.1.jar
file.reference.cassandra.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\cassandra.jar
file.reference.catalina-ant.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\catalina-ant.jar
file.reference.cglib-2.2.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\cglib-2.2.jar
file.reference.colt-1.2.0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\colt-1.2.0.jar
file.reference.commons-cli-1.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-cli-1.1.jar
file.reference.commons-codec-1.3.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-codec-1.3.jar
file.reference.commons-collections-3.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-collections-3.1.jar
file.reference.commons-collections-3.2.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-collections-3.2.1.jar
file.reference.commons-dbcp-1.2.2.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-dbcp-1.2.2.jar
file.reference.commons-httpclient-3.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-httpclient-3.1.jar
file.reference.commons-io-1.3.2.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-io-1.3.2.jar
file.reference.commons-lang-2.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-lang-2.1.jar
file.reference.commons-logging.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-logging.jar
file.reference.commons-javaflow-1.0-SNAPSHOT.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-javaflow-1.0-SNAPSHOT.jar
file.reference.commons-lang-2.4.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-lang-2.4.jar
file.reference.commons-logging-1.0.4.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-logging-1.0.4.jar
file.reference.commons-math-1.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-math-1.1.jar
file.reference.commons-pool-1.4.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\commons-pool-1.4.jar
file.reference.configgy-1.2.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\configgy-1.2.jar
file.reference.google-collect-snapshot-20090211.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\google-collect-snapshot-20090211.jar
@ -44,6 +50,7 @@ file.reference.grizzly-rcm-1.8.6.3.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\
file.reference.grizzly-servlet-webserver-1.8.6.3.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\grizzly-servlet-webserver-1.8.6.3.jar
file.reference.guice-core-2.0-SNAPSHOT.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\guice-core-2.0-SNAPSHOT.jar
file.reference.guice-jsr250-2.0-SNAPSHOT.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\guice-jsr250-2.0-SNAPSHOT.jar
file.reference.high-scale-lib.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\high-scale-lib.jar
file.reference.jaxb-api-2.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\jaxb-api-2.1.jar
file.reference.jaxb-impl-2.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\jaxb-impl-2.1.jar
file.reference.jdom-1.0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\jdom-1.0.jar
@ -55,24 +62,32 @@ file.reference.jersey-server-1.0.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\
file.reference.jettison-1.0.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\jettison-1.0.1.jar
file.reference.jetty-6.1.6rc0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\jetty-6.1.6rc0.jar
file.reference.jetty-util-6.1.6rc0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\jetty-util-6.1.6rc0.jar
file.reference.JSAP-2.1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\JSAP-2.1.jar
file.reference.jsr250-api-1.0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\jsr250-api-1.0.jar
file.reference.jsr311-api-1.0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\jsr311-api-1.0.jar
file.reference.junit-3.8.2.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\junit-3.8.2.jar
file.reference.junit-4.5.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\junit-4.5.jar
file.reference.junit4runner-1.0-SNAPSHOT.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\junit4runner-1.0-SNAPSHOT.jar
file.reference.libfb303.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\libfb303.jar
file.reference.libthrift-20080411p1.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\libthrift-20080411p1.jar
file.reference.log4j-1.2.13.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\log4j-1.2.13.jar
file.reference.libthrift.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\libthrift.jar
file.reference.log4j-1.2.15.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\log4j-1.2.15.jar
file.reference.lucene-core-2.2.0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\lucene-core-2.2.0.jar
file.reference.main-scala=src/main/scala
file.reference.mina-core-2.0.0-M2-SNAPSHOT.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\mina-core-2.0.0-M2-SNAPSHOT.jar
file.reference.mina-integration-scala-2.0.0-M2-SNAPSHOT.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\mina-integration-scala-2.0.0-M2-SNAPSHOT.jar
file.reference.pcj.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\pcj.jar
file.reference.protobuf-java-2.0.3.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\protobuf-java-2.0.3.jar
file.reference.rome-0.9.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\rome-0.9.jar
file.reference.scala-library-2.7.3.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\scala-library-2.7.3.jar
file.reference.scala-library-2.7.3.zip=C:\\home\\jboner\\src\\scala\\akka\\lib\\scala-library-2.7.3.zip
file.reference.scalatest-0.9.5.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\scalatest-0.9.5.jar
file.reference.scalatest-0.9.5.zip=C:\\home\\jboner\\src\\scala\\akka\\lib\\scalatest-0.9.5.zip
file.reference.servlet-api-2.5.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\servlet-api-2.5.jar
file.reference.slf4j-api-1.4.3.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\slf4j-api-1.4.3.jar
file.reference.slf4j-log4j12-1.4.3.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\slf4j-log4j12-1.4.3.jar
file.reference.stax-api-1.0-2.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\stax-api-1.0-2.jar
file.reference.stringtemplate-3.0.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\stringtemplate-3.0.jar
file.reference.test-scala=src/test/scala
file.reference.velocity-1.5.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\velocity-1.5.jar
file.reference.voldemort-0.4a.jar=C:\\home\\jboner\\src\\scala\\akka\\lib\\voldemort-0.4a.jar
@ -84,19 +99,25 @@ jar.compress=false
java.platform.active=java_default_platform
javac.classpath=\
${file.reference.activation-1.1.jar}:\
${file.reference.aopalliance-1.0.jar}:\
${file.reference.akka-util-java.jar}:\
${file.reference.antlr-3.1.3.jar}:\
${file.reference.aopalliance-1.0.jar}:\
${file.reference.asm-3.1.jar}:\
${file.reference.asm-all-2.2.1.jar}:\
${file.reference.cassandra.jar}:\
${file.reference.catalina-ant.jar}:\
${file.reference.cglib-2.2.jar}:\
${file.reference.colt-1.2.0.jar}:\
${file.reference.commons-cli-1.1.jar}:\
${file.reference.commons-codec-1.3.jar}:\
${file.reference.commons-collections-3.1.jar}:\
${file.reference.commons-collections-3.2.1.jar}:\
${file.reference.commons-dbcp-1.2.2.jar}:\
${file.reference.commons-httpclient-3.1.jar}:\
${file.reference.commons-io-1.3.2.jar}:\
${file.reference.commons-lang-2.1.jar}:\
${file.reference.commons-logging.jar}:\
${file.reference.commons-javaflow-1.0-SNAPSHOT.jar}:\
${file.reference.commons-lang-2.4.jar}:\
${file.reference.commons-logging-1.0.4.jar}:\
${file.reference.commons-math-1.1.jar}:\
${file.reference.commons-pool-1.4.jar}:\
${file.reference.configgy-1.2.jar}:\
${file.reference.google-collect-snapshot-20090211.jar}:\
@ -109,6 +130,7 @@ javac.classpath=\
${file.reference.grizzly-servlet-webserver-1.8.6.3.jar}:\
${file.reference.guice-core-2.0-SNAPSHOT.jar}:\
${file.reference.guice-jsr250-2.0-SNAPSHOT.jar}:\
${file.reference.high-scale-lib.jar}:\
${file.reference.jaxb-api-2.1.jar}:\
${file.reference.jaxb-impl-2.1.jar}:\
${file.reference.jdom-1.0.jar}:\
@ -120,28 +142,36 @@ javac.classpath=\
${file.reference.jettison-1.0.1.jar}:\
${file.reference.jetty-6.1.6rc0.jar}:\
${file.reference.jetty-util-6.1.6rc0.jar}:\
${file.reference.JSAP-2.1.jar}:\
${file.reference.jsr250-api-1.0.jar}:\
${file.reference.jsr311-api-1.0.jar}:\
${file.reference.junit-3.8.2.jar}:\
${file.reference.junit-4.5.jar}:\
${file.reference.junit4runner-1.0-SNAPSHOT.jar}:\
${file.reference.libfb303.jar}:\
${file.reference.libthrift-20080411p1.jar}:\
${file.reference.log4j-1.2.13.jar}:\
${file.reference.libthrift.jar}:\
${file.reference.log4j-1.2.15.jar}:\
${file.reference.lucene-core-2.2.0.jar}:\
${file.reference.mina-core-2.0.0-M2-SNAPSHOT.jar}:\
${file.reference.mina-integration-scala-2.0.0-M2-SNAPSHOT.jar}:\
${file.reference.pcj.jar}:\
${file.reference.protobuf-java-2.0.3.jar}:\
${file.reference.rome-0.9.jar}:\
${file.reference.scala-library-2.7.3.jar}:\
${file.reference.scala-library-2.7.3.zip}:\
${file.reference.scalatest-0.9.5.jar}:\
${file.reference.scalatest-0.9.5.zip}:\
${file.reference.servlet-api-2.5.jar}:\
${file.reference.slf4j-api-1.4.3.jar}:\
${file.reference.slf4j-log4j12-1.4.3.jar}:\
${file.reference.stax-api-1.0-2.jar}:\
${file.reference.stringtemplate-3.0.jar}:\
${file.reference.velocity-1.5.jar}:\
${file.reference.voldemort-0.4a.jar}:\
${file.reference.voldemort-contrib-0.4a.jar}:\
${file.reference.xerces.jar}:\
${file.reference.zookeeper-3.1.0.jar}:\
${file.reference.junit4runner-1.0-SNAPSHOT.jar}:\
${file.reference.junit-4.5.jar}
${file.reference.zookeeper-3.1.0.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View file

@ -0,0 +1,73 @@
/**
* Copyright (C) 2009 Scalable Solutions.
*/
package se.scalablesolutions.akka.kernel
import java.io.File
import com.facebook.thrift.protocol.TBinaryProtocol
import com.facebook.thrift.protocol.TProtocolFactory
import com.facebook.thrift.server.TThreadPoolServer
import com.facebook.thrift.transport.TServerSocket
import com.facebook.thrift.transport.TTransportException
import com.facebook.thrift.transport.TTransportFactory
import com.facebook.thrift.TProcessorFactory
import org.apache.cassandra.config.DatabaseDescriptor
import org.apache.cassandra.service._
/**
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
final class CassandraNode extends Logging {
val server = try {
val cassandra = new CassandraServer
cassandra.start
cassandra
} catch {
case e =>
log.error("Could not start up persistent storage node")
throw e
}
private val serverEngine: TThreadPoolServer = try {
val pidFile = System.getProperty("pidfile")
if (pidFile != null) new File(pidFile).deleteOnExit();
val listenPort = DatabaseDescriptor.getThriftPort
val processor = new Cassandra.Processor(server)
val tServerSocket = new TServerSocket(listenPort)
val tProtocolFactory = new TBinaryProtocol.Factory
val options = new TThreadPoolServer.Options
options.minWorkerThreads = 64
new TThreadPoolServer(new TProcessorFactory(processor),
tServerSocket,
new TTransportFactory,
new TTransportFactory,
tProtocolFactory,
tProtocolFactory,
options)
} catch {
case e =>
log.error("Could not start up persistent storage node.")
throw e
}
def start = {
scala.actors.Actor.actor {
log.info("Persistent storage node starting up...");
serverEngine.serve
}
log.info("Persistent storage node starting up 2222...");
server.insert("akka", "TestActor", "hash:data", "some data", System.currentTimeMillis)
val column = server.get_column("akka", "TestActor", "hash:data")
log.info("column: " + column)
}
def stop = {
log.info("Persistent storage node shutting down...")
serverEngine.stop
}
}

View file

@ -30,7 +30,7 @@ import javax.management.JMException
object Kernel extends Logging {
val SERVER_URL = "localhost"
val JERSEY_SERVER_URL = "http://" + SERVER_URL + "/"
val JERSEY_SERVER_PORT = 9998
val JERSEY_REST_CLASSES_ROOT_PACKAGE = "se.scalablesolutions.akka.kernel"
@ -43,12 +43,16 @@ object Kernel extends Logging {
val ZOO_KEEPER_SERVER_URL = SERVER_URL
val ZOO_KEEPER_SERVER_PORT = 9898
private[this] var storageFactory: StoreClientFactory = _
private[this] var storageServer: VoldemortServer = _
private[this] var cassandraNode: CassandraNode = _
//private[this] var storageFactory: StoreClientFactory = _
//private[this] var storageServer: VoldemortServer = _
def main(args: Array[String]): Unit = {
log.info("Starting Akka kernel...")
//startZooKeeper
startVoldemort
//startVoldemort
startCassandra
//val threadSelector = startJersey
// TODO: handle shutdown of Jersey in separate thread
@ -65,51 +69,56 @@ object Kernel extends Logging {
GrizzlyWebContainerFactory.create(JERSEY_BASE_URI, initParams)
}
private[akka] def startVoldemort = {
// Start Voldemort server
val config = VoldemortConfig.loadFromVoldemortHome(Boot.HOME)
storageServer = new VoldemortServer(config)
storageServer.start
log.info("Replicated persistent storage server started at %s", VOLDEMORT_BOOTSTRAP_URL)
// Create Voldemort client factory
val numThreads = 10
val maxQueuedRequests = 10
val maxConnectionsPerNode = 10
val maxTotalConnections = 100
storageFactory = new SocketStoreClientFactory(
numThreads,
numThreads,
maxQueuedRequests,
maxConnectionsPerNode,
maxTotalConnections,
VOLDEMORT_BOOTSTRAP_URL)
val name = this.getClass.getName
val storage = getStorageFor("actors")
// val value = storage.get(name)
val value = new Versioned("state")
//value.setObject("state")
storage.put(name, value)
private[akka] def startCassandra = {
cassandraNode = new CassandraNode
cassandraNode.start
}
private[akka] def getStorageFor(storageName: String): StoreClient[String, String] =
storageFactory.getStoreClient(storageName)
// private[akka] def startVoldemort = {
// // Start Voldemort server
// val config = VoldemortConfig.loadFromVoldemortHome(Boot.HOME)
// storageServer = new VoldemortServer(config)
// storageServer.start
// log.info("Replicated persistent storage server started at %s", VOLDEMORT_BOOTSTRAP_URL)
//
// // Create Voldemort client factory
// val numThreads = 10
// val maxQueuedRequests = 10
// val maxConnectionsPerNode = 10
// val maxTotalConnections = 100
// storageFactory = new SocketStoreClientFactory(
// numThreads,
// numThreads,
// maxQueuedRequests,
// maxConnectionsPerNode,
// maxTotalConnections,
// VOLDEMORT_BOOTSTRAP_URL)
//
// val name = this.getClass.getName
// val storage = getStorageFor("actors")
//// val value = storage.get(name)
// val value = new Versioned("state")
// //value.setObject("state")
// storage.put(name, value)
// }
//
// private[akka] def getStorageFor(storageName: String): StoreClient[String, String] =
// storageFactory.getStoreClient(storageName)
// private[akka] def startZooKeeper = {
// try {
// ManagedUtil.registerLog4jMBeans
// ServerConfig.parse(args)
// } catch {
// } catch {
// case e: JMException => log.warning("Unable to register log4j JMX control: s%", e)
// case e => log.fatal("Error in ZooKeeper config: s%", e)
// case e => log.fatal("Error in ZooKeeper config: s%", e)
// }
// val factory = new ZooKeeperServer.Factory() {
// override def createConnectionFactory = new NIOServerCnxn.Factory(ServerConfig.getClientPort)
// override def createServer = {
// val server = new ZooKeeperServer
// val txLog = new FileTxnSnapLog(
// new File(ServerConfig.getDataLogDir),
// new File(ServerConfig.getDataLogDir),
// new File(ServerConfig.getDataDir))
// server.setTxnLogFactory(txLog)
// server
@ -124,7 +133,7 @@ object Kernel extends Logging {
// // cnxnFactory.setZooKeeperServer(zooKeeper)
// // cnxnFactory.join
// // if (zooKeeper.isRunning) zooKeeper.shutdown
// } catch { case e => log.fatal("Unexpected exception: s%",e) }
// } catch { case e => log.fatal("Unexpected exception: s%",e) }
// }
private def getPort(defaultPort: Int) = {

View file

@ -1,110 +1,110 @@
/**
* Copyright (C) 2009 Scalable Solutions.
*/
package se.scalablesolutions.akka.kernel
import se.scalablesolutions.akka.collection._
import scala.collection.mutable.{HashMap}
trait Transactional {
private[kernel] def begin
private[kernel] def commit
private[kernel] def rollback
}
sealed trait State[K, V] extends Transactional {
def put(key: K, value: V)
def remove(key: K)
def get(key: K): V
def contains(key: K): Boolean
def elements: Iterator[(K, V)]
def size: Int
def clear
}
/**
* Not thread-safe, but should only be using from within an Actor, e.g. one single thread at a time.
*/
sealed class TransientState[K, V] extends State[K, V] {
private[kernel] var state = new HashTrie[K, V]
private[kernel] var snapshot = state
private[kernel] override def begin = {
snapshot = state
}
private[kernel] override def commit = {
snapshot = state
}
private[kernel] override def rollback = {
state = snapshot
}
override def put(key: K, value: V) = {
state = state.update(key, value)
}
override def remove(key: K) = {
state = state - key
}
def get(key: K): V = state.get(key).getOrElse { throw new NoSuchElementException("No value for key [" + key + "]") }
def contains(key: K): Boolean = state.contains(key)
def elements: Iterator[(K, V)] = state.elements
def size: Int = state.size
def clear = state = new HashTrie[K, V]
}
final class TransientStringState extends TransientState[String, String]
final class TransientObjectState extends TransientState[String, AnyRef]
/**
* Not thread-safe, but should only be using from within an Actor, e.g. one single thread at a time.
*/
trait UnitOfWork[K, V] extends State[K, V] with Transactional {
this: TransientState[K, V] =>
private[kernel] val changeSet = new HashMap[K, V]
abstract override def begin = {
super.begin
changeSet.clear
}
abstract override def put(key: K, value: V) = {
super.put(key, value)
changeSet += key -> value
}
abstract override def remove(key: K) = {
super.remove(key)
changeSet -= key
}
}
//class VectorState[T] {
// private[kernel] var state: Vector[T] = EmptyVector
// private[kernel] var snapshot = state
// private[kernel] var unitOfWork: List[T] = Nil
//
// private[kernel] def record = {
// snapshot = state
// unitOfWork = Nil
// }
//
// def add(elem: T): VectorState[T] = {
// state = state + elem
// unitOfWork ::= elem
// }
//
// def get(index: Int): T = state(index)
//
// def size: Int = state.size
//}
//
//
/**
* Copyright (C) 2009 Scalable Solutions.
*/
package se.scalablesolutions.akka.kernel
import se.scalablesolutions.akka.collection._
import scala.collection.mutable.HashMap
trait Transactional {
private[kernel] def begin
private[kernel] def commit
private[kernel] def rollback
}
sealed trait State[K, V] extends Transactional {
def put(key: K, value: V)
def remove(key: K)
def get(key: K): V
def contains(key: K): Boolean
def elements: Iterator[(K, V)]
def size: Int
def clear
}
/**
* Not thread-safe, but should only be using from within an Actor, e.g. one single thread at a time.
*/
sealed class InMemoryState[K, V] extends State[K, V] {
private[kernel] var state = new HashTrie[K, V]
private[kernel] var snapshot = state
private[kernel] override def begin = {
snapshot = state
}
private[kernel] override def commit = {
snapshot = state
}
private[kernel] override def rollback = {
state = snapshot
}
override def put(key: K, value: V) = {
state = state.update(key, value)
}
override def remove(key: K) = {
state = state - key
}
def get(key: K): V = state.get(key).getOrElse { throw new NoSuchElementException("No value for key [" + key + "]") }
def contains(key: K): Boolean = state.contains(key)
def elements: Iterator[(K, V)] = state.elements
def size: Int = state.size
def clear = state = new HashTrie[K, V]
}
//final class InMemoryStringState extends InMemoryState[String, String]
//final class InMemoryObjectState extends InMemoryState[String, AnyRef]
//
/**
* Not thread-safe, but should only be using from within an Actor, e.g. one single thread at a time.
*/
trait UnitOfWork[K, V] extends State[K, V] with Transactional {
this: InMemoryState[K, V] =>
private[kernel] val changeSet = new HashMap[K, V]
abstract override def begin = {
super.begin
changeSet.clear
}
abstract override def put(key: K, value: V) = {
super.put(key, value)
changeSet += key -> value
}
abstract override def remove(key: K) = {
super.remove(key)
changeSet -= key
}
}
//class VectorState[T] {
// private[kernel] var state: Vector[T] = EmptyVector
// private[kernel] var snapshot = state
// private[kernel] var unitOfWork: List[T] = Nil
//
// private[kernel] def record = {
// snapshot = state
// unitOfWork = Nil
// }
//
// def add(elem: T): VectorState[T] = {
// state = state + elem
// unitOfWork ::= elem
// }
//
// def get(index: Int): T = state(index)
//
// def size: Int = state.size
//}
//
//

View file

@ -7,7 +7,7 @@ package se.scalablesolutions.akka.kernel
import java.util.concurrent.atomic.AtomicLong
import scala.collection.mutable.HashMap
sealed abstract case class TransactionStatus
sealed abstract class TransactionStatus
object TransactionStatus {
case object New extends TransactionStatus
case object Active extends TransactionStatus