Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added getPendingMutationSize to Mutator

  • Loading branch information...
commit ae56f633b0f362fb93558ac70bef723ea1aefeb3 1 parent c0c78c1
@zznate zznate authored
View
5 core/src/main/java/me/prettyprint/cassandra/model/MutatorImpl.java
@@ -265,6 +265,11 @@ public String toString() {
return "Mutator(" + keyspace.toString() + ")";
}
+ @Override
+ public int getPendingMutationCount() {
+ return getPendingMutations().getSize();
+ }
+
private BatchMutation<K> getPendingMutations() {
if (pendingMutations == null) {
pendingMutations = new BatchMutation<K>(keySerializer, sizeHint);
View
8 core/src/main/java/me/prettyprint/cassandra/service/BatchMutation.java
@@ -155,4 +155,12 @@ private void addMutation(K key, List<String> columnFamilies, Mutation mutation)
public boolean isEmpty() {
return mutationMap.isEmpty() ;
}
+
+ /**
+ * Return the current size of the underlying map
+ * @return
+ */
+ public int getSize() {
+ return mutationMap.size();
+ }
}
View
5 core/src/main/java/me/prettyprint/hector/api/mutation/Mutator.java
@@ -218,4 +218,9 @@
*/
<SN,N> Mutator<K> addCounterSubDeletion(K key, String cf, HCounterSuperColumn<SN,N> sc);
+ /**
+ * Get the size of the pending mutations map
+ */
+ int getPendingMutationCount();
+
}
View
1  core/src/test/java/me/prettyprint/cassandra/model/MutatorTest.java
@@ -150,6 +150,7 @@ public void testBatchMutationManagement() {
for (int i = 0; i < 5; i++) {
m.addInsertion("k" + i, cf, createColumn("name", "value" + i, se, se));
}
+ assertEquals(5, m.getPendingMutationCount());
MutationResult r = m.execute();
assertTrue("Execute time should be > 0", r.getExecutionTimeMicro() > 0);
assertTrue("Should have operated on a host", r.getHostUsed() != null);
Please sign in to comment.
Something went wrong with that request. Please try again.