Bug 2948: Add getLastSequenceNumber method to DataPersistenceProvider 95/17795/3
authorTom Pantelis <tpanteli@brocade.com>
Sat, 4 Apr 2015 02:01:40 +0000 (22:01 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Fri, 10 Apr 2015 21:49:32 +0000 (17:49 -0400)
New method that returns the last sequence number from akka's persisted
journal. This will be used in a subsequent patch.

Change-Id: Ie2b77358c57eb3e30fea7af317f277d7e660125e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/DataPersistenceProvider.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/DelegatingPersistentDataProvider.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/NonPersistentDataProvider.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/PersistentDataProvider.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/DataPersistenceProviderMonitor.java

index c74236b..e27fa26 100644 (file)
@@ -54,4 +54,9 @@ public class DelegatingPersistentDataProvider implements DataPersistenceProvider
     public void deleteMessages(long sequenceNumber) {
         delegate.deleteMessages(sequenceNumber);
     }
+
+    @Override
+    public long getLastSequenceNumber() {
+        return delegate.getLastSequenceNumber();
+    }
 }
index fed8117..d1af58f 100644 (file)
@@ -43,4 +43,9 @@ public class NonPersistentDataProvider implements DataPersistenceProvider {
     @Override
     public void deleteMessages(long sequenceNumber) {
     }
+
+    @Override
+    public long getLastSequenceNumber() {
+        return -1;
+    }
 }
\ No newline at end of file
index f130a1f..4ccd5f4 100644 (file)
@@ -47,4 +47,9 @@ public class PersistentDataProvider implements DataPersistenceProvider {
     public void deleteMessages(long sequenceNumber) {
         persistentActor.deleteMessages(sequenceNumber);
     }
+
+    @Override
+    public long getLastSequenceNumber() {
+        return persistentActor.lastSequenceNr();
+    }
 }
\ No newline at end of file
index 33d4056..bad9fc3 100644 (file)
@@ -10,9 +10,8 @@ package org.opendaylight.controller.cluster.datastore;
 
 import akka.japi.Procedure;
 import akka.persistence.SnapshotSelectionCriteria;
-import org.opendaylight.controller.cluster.DataPersistenceProvider;
-
 import java.util.concurrent.CountDownLatch;
+import org.opendaylight.controller.cluster.DataPersistenceProvider;
 
 /**
  * This class is intended for testing purposes. It just triggers CountDownLatch's in each method.
@@ -65,4 +64,9 @@ public class DataPersistenceProviderMonitor implements DataPersistenceProvider {
     public void setDeleteMessagesLatch(CountDownLatch deleteMessagesLatch) {
         this.deleteMessagesLatch = deleteMessagesLatch;
     }
+
+    @Override
+    public long getLastSequenceNumber() {
+        return -1;
+    }
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.