diff --git a/akka-persistence/akka-persistence-couchdb/src/main/scala/CouchDBStorage.scala b/akka-persistence/akka-persistence-couchdb/src/main/scala/CouchDBStorage.scala new file mode 100644 index 0000000000..80441b562b --- /dev/null +++ b/akka-persistence/akka-persistence-couchdb/src/main/scala/CouchDBStorage.scala @@ -0,0 +1,47 @@ +package se.scalablesolutions.akka.persistence.couchdb + +import se.scalablesolutions.akka.actor.{newUuid} +import se.scalablesolutions.akka.stm._ +import se.scalablesolutions.akka.persistence.common._ + +object CouchDBStorage extends Storage { + type ElementType = Array[Byte] + + def newMap: PersistentMap[ElementType, ElementType] = newMap(newUuid.toString) + def newVector: PersistentVector[ElementType] = newVector(newUuid.toString) + def newRef: PersistentRef[ElementType] = newRef(newUuid.toString) + + def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id) + def getVector(id: String): PersistentVector[ElementType] = newVector(id) + def getRef(id: String): PersistentRef[ElementType] = newRef(id) + + def newMap(id: String): PersistentMap[ElementType, ElementType] = new CouchDBPersistentMap(id) + def newVector(id: String): PersistentVector[ElementType] = new CouchDBPersistentVector(id) + def newRef(id: String): PersistentRef[ElementType] = new CouchDBPersistentRef(id) +} + +/** + * Implements a persistent transactional map based on the CouchDB storage. + * + * @author + */ +class CouchDBPersistentMap(id: String) extends PersistentMapBinary { + val uuid = id + val storage = CouchDBStorageBackend +} + +/** + * Implements a persistent transactional vector based on the CouchDB + * storage. + * + * @author + */ +class CouchDBPersistentVector(id: String) extends PersistentVector[Array[Byte]] { + val uuid = id + val storage = CouchDBStorageBackend +} + +class CouchDBPersistentRef(id: String) extends PersistentRef[Array[Byte]] { + val uuid = id + val storage = CouchDBStorageBackend +} \ No newline at end of file diff --git a/akka-persistence/akka-persistence-couchdb/src/main/scala/CouchDBStorageBackend.scala b/akka-persistence/akka-persistence-couchdb/src/main/scala/CouchDBStorageBackend.scala new file mode 100644 index 0000000000..1d641e5468 --- /dev/null +++ b/akka-persistence/akka-persistence-couchdb/src/main/scala/CouchDBStorageBackend.scala @@ -0,0 +1,14 @@ +package se.scalablesolutions.akka.persistence.couchdb + +import se.scalablesolutions.akka.stm._ +import se.scalablesolutions.akka.persistence.common._ +import se.scalablesolutions.akka.util.Logging +import se.scalablesolutions.akka.config.Config.config + +private [akka] object CouchDBStorageBackend extends + MapStorageBackend[Array[Byte], Array[Byte]] with + VectorStorageBackend[Array[Byte]] with + RefStorageBackend[Array[Byte]] with + Logging { +// need couch db implementation! +} \ No newline at end of file diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index 3d40fe613b..6e691c4ada 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -499,6 +499,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { new AkkaHbaseProject(_), akka_persistence_common) lazy val akka_persistence_voldemort = project("akka-persistence-voldemort", "akka-persistence-voldemort", new AkkaVoldemortProject(_), akka_persistence_common) + lazy val akka_persistence_couchdb = project("akka_persistence_couchdb", "akka_persistence_couchdb", + new AkkaCouchDBProject(_), akka_persistence_common) } // ------------------------------------------------------------------------------------------------------------------- @@ -598,6 +600,9 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { override def testOptions = createTestFilter( _.endsWith("Suite")) } + class AkkaCouchDBProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { + + } // ------------------------------------------------------------------------------------------------------------------- // akka-kernel subproject