activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1234435 - in /activemq/activemq-apollo/trunk: apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/ apollo-leveldb/src/main/scala/org/apache/activemq/apoll...
Date Sat, 21 Jan 2012 22:34:53 GMT
Author: chirino
Date: Sat Jan 21 22:34:53 2012
New Revision: 1234435

URL: http://svn.apache.org/viewvc?rev=1234435&view=rev
Log:
Fixes needed to make the LevelDB and BDB store export formats compatible.

Modified:
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/HelperTrait.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreExport.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreImport.scala
    activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala

Modified: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala?rev=1234435&r1=1234434&r2=1234435&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala
Sat Jan 21 22:34:53 2012
@@ -550,19 +550,19 @@ class BDBClient(store: BDBStore) {
         import ctx._
 
         messages_db.cursor(tx) { (_, value) =>
-          val record = MessagePB.FACTORY.parseUnframed(value.getData)
+          val record = MessagePB.FACTORY.parseFramed(value.getData)
           manager.store_message(record)
           true
         }
 
         entries_db.cursor(tx) { (key, value) =>
-          val record = QueueEntryPB.FACTORY.parseUnframed(value.getData)
+          val record = QueueEntryPB.FACTORY.parseFramed(value.getData)
           manager.store_queue_entry(record)
           true
         }
 
         queues_db.cursor(tx) { (_, value) =>
-          val record = QueuePB.FACTORY.parseUnframed(value)
+          val record = QueuePB.FACTORY.parseFramed(value)
           manager.store_queue(record)
           true
         }
@@ -599,16 +599,17 @@ class BDBClient(store: BDBStore) {
         while(manager.getNext match {
 
           case record:MessagePB.Buffer =>
-            messages_db.put(tx, record.getMessageKey, record.toUnframedBuffer)
+            messages_db.put(tx, record.getMessageKey, record.toFramedBuffer)
             true
 
           case record:QueueEntryPB.Buffer =>
-            entries_db.put(tx, (record.getQueueKey, record.getQueueSeq), record.toUnframedBuffer)
+            entries_db.put(tx, (record.getQueueKey, record.getQueueSeq), record.toFramedBuffer)
             add_and_get(message_refs_db, record.getMessageKey, 1, tx)
             true
 
           case record:QueuePB.Buffer =>
-            queues_db.put(tx, record.getKey, record.toUnframedBuffer)
+            var key: Long = record.getKey
+            queues_db.put(tx, key, record.toFramedBuffer)
             true
 
           case record:MapEntryPB.Buffer =>

Modified: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/HelperTrait.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/HelperTrait.scala?rev=1234435&r1=1234434&r2=1234435&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/HelperTrait.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/HelperTrait.scala
Sat Jan 21 22:34:53 2012
@@ -26,8 +26,8 @@ import org.fusesource.hawtbuf._
 
 object HelperTrait {
 
-  implicit def to_message_buffer(entry: DatabaseEntry): MessagePB.Buffer = MessagePB.FACTORY.parseUnframed(entry.getData)
-  implicit def to_database_entry(v: MessagePB.Buffer): DatabaseEntry = new DatabaseEntry(v.toUnframedByteArray)
+  implicit def to_message_buffer(entry: DatabaseEntry): MessagePB.Buffer = MessagePB.FACTORY.parseFramed(entry.getData)
+  implicit def to_database_entry(v: MessagePB.Buffer): DatabaseEntry = new DatabaseEntry(v.toFramedByteArray)
 
   implicit def to_queue_entry_record(entry: DatabaseEntry): QueueEntryRecord = entry.getData
   implicit def to_database_entry(v: QueueEntryRecord): DatabaseEntry = new DatabaseEntry(v)

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreExport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreExport.scala?rev=1234435&r1=1234434&r2=1234435&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreExport.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreExport.scala
Sat Jan 21 22:34:53 2012
@@ -20,13 +20,10 @@ import org.apache.felix.gogo.commands.{A
 import org.apache.activemq.apollo.util.FileSupport._
 import org.apache.activemq.apollo.dto.VirtualHostDTO
 import org.apache.activemq.apollo.util._
-import java.util.zip.{ZipEntry, ZipOutputStream}
 import org.apache.felix.service.command.CommandSession
 import org.apache.activemq.apollo.broker.ConfigStore
 import java.io._
-import java.util.concurrent.CountDownLatch
-import org.apache.activemq.apollo.broker.store.ExportStreamManager._
-import org.apache.activemq.apollo.broker.store.{ExportStreamManager, StreamManager, StoreFactory}
+import org.apache.activemq.apollo.broker.store.StoreFactory
 
 /**
  * The apollo stop command
@@ -83,9 +80,9 @@ class StoreExport extends Action {
       ServiceControl.start(store, "store startup")
 
       session.getConsole.println("Exporting... (this might take a while)")
-      using( ExportStreamManager(new BufferedOutputStream(new FileOutputStream(file)))) {
manager=>
+      using( new BufferedOutputStream(new FileOutputStream(file)) ) { os=>
         sync_cb[Option[String]] { cb =>
-          store.export_data(manager, cb)
+          store.export_data(os, cb)
         }.foreach(error _)
       }
       ServiceControl.stop(store, "store stop");

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreImport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreImport.scala?rev=1234435&r1=1234434&r2=1234435&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreImport.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/StoreImport.scala
Sat Jan 21 22:34:53 2012
@@ -20,13 +20,10 @@ import org.apache.felix.gogo.commands.{A
 import org.apache.activemq.apollo.util.FileSupport._
 import org.apache.activemq.apollo.dto.VirtualHostDTO
 import org.apache.activemq.apollo.util._
-import scala.util.continuations._
-import java.util.zip.ZipFile
 import org.apache.felix.service.command.CommandSession
 import org.apache.activemq.apollo.broker.ConfigStore
-import org.apache.activemq.apollo.broker.store.ImportStreamManager._
-import org.apache.activemq.apollo.broker.store.{ImportStreamManager, StreamManager, StoreFactory}
-import java.io.{FileInputStream, BufferedInputStream, InputStream, File}
+import org.apache.activemq.apollo.broker.store.{ImportStreamManager, StoreFactory}
+import java.io.{FileInputStream, BufferedInputStream, File}
 
 
 /**
@@ -84,9 +81,9 @@ class StoreImport extends Action {
       ServiceControl.start(store, "store startup")
 
       session.getConsole.println("Importing: "+file)
-      using( ImportStreamManager(new BufferedInputStream(new FileInputStream(file)))) { manager
=>
+      using( new BufferedInputStream(new FileInputStream(file)) ) { is =>
         sync_cb[Option[String]] { cb =>
-          store.import_data(manager, cb)
+          store.import_data(is, cb)
         }.foreach(error _)
       }
 

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala?rev=1234435&r1=1234434&r2=1234435&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
Sat Jan 21 22:34:53 2012
@@ -262,7 +262,7 @@ class LevelDBClient(store: LevelDBStore)
 
     index_options.cacheSize(Option(config.index_cache_size).map(MemoryPropertyEditor.parse(_).toLong).getOrElse(1024*1024*256L))
     index_options.logger(new Logger() {
-      def log(msg: String) = trace(store.store_kind+": "+msg.stripSuffix("\n"))
+      def log(msg: String) = trace(msg.stripSuffix("\n"))
     })
 
     log = create_log



Mime
View raw message