fluo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject incubator-fluo-recipes git commit: Update for changes from apache/incubator-fluo#714
Date Wed, 07 Sep 2016 17:30:06 GMT
Repository: incubator-fluo-recipes
Updated Branches:
  refs/heads/master 138e1617e -> 91ff0776f


Update for changes from apache/incubator-fluo#714


Project: http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/commit/91ff0776
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/tree/91ff0776
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/diff/91ff0776

Branch: refs/heads/master
Commit: 91ff0776f949c761d8b2d5cb39006f75299c538e
Parents: 138e161
Author: Keith Turner <kturner@apache.org>
Authored: Wed Sep 7 12:38:57 2016 -0400
Committer: Keith Turner <kturner@apache.org>
Committed: Wed Sep 7 12:38:57 2016 -0400

----------------------------------------------------------------------
 .../org/apache/fluo/recipes/core/data/RowHasher.java |  2 +-
 .../fluo/recipes/core/export/ExportBucket.java       |  6 +++---
 .../fluo/recipes/core/map/CollisionFreeMap.java      | 15 +++++++--------
 .../fluo/recipes/core/transaction/LogEntry.java      |  6 +++---
 .../core/transaction/RecordingTransactionBase.java   | 13 +++++++------
 .../fluo/recipes/core/types/TypedSnapshotBase.java   |  7 ++++---
 .../recipes/core/types/TypedTransactionBase.java     |  6 +++---
 .../fluo/recipes/core/types/MockSnapshotBase.java    |  7 ++++---
 .../fluo/recipes/core/types/MockTransactionBase.java |  6 +++---
 9 files changed, 35 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/main/java/org/apache/fluo/recipes/core/data/RowHasher.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/recipes/core/data/RowHasher.java b/modules/core/src/main/java/org/apache/fluo/recipes/core/data/RowHasher.java
index 55f1c9a..59aef51 100644
--- a/modules/core/src/main/java/org/apache/fluo/recipes/core/data/RowHasher.java
+++ b/modules/core/src/main/java/org/apache/fluo/recipes/core/data/RowHasher.java
@@ -86,7 +86,7 @@ public class RowHasher {
    * @return Returns input with prefix and hash of input prepended.
    */
   public Bytes addHash(Bytes row) {
-    BytesBuilder builder = Bytes.newBuilder(prefix.length() + 5 + row.length());
+    BytesBuilder builder = Bytes.builder(prefix.length() + 5 + row.length());
     builder.append(prefix);
     builder.append(genHash(row));
     builder.append(":");

http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/main/java/org/apache/fluo/recipes/core/export/ExportBucket.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/recipes/core/export/ExportBucket.java
b/modules/core/src/main/java/org/apache/fluo/recipes/core/export/ExportBucket.java
index 7c5c366..6dadb8c 100644
--- a/modules/core/src/main/java/org/apache/fluo/recipes/core/export/ExportBucket.java
+++ b/modules/core/src/main/java/org/apache/fluo/recipes/core/export/ExportBucket.java
@@ -102,7 +102,7 @@ class ExportBucket {
 
   public void add(long seq, byte[] key, byte[] value) {
     Bytes row =
-        Bytes.newBuilder(bucketRow.length() + 1 + key.length + 8).append(bucketRow).append(":")
+        Bytes.builder(bucketRow.length() + 1 + key.length + 8).append(bucketRow).append(":")
             .append(key).append(encSeq(seq)).toBytes();
     ttx.set(row, EXPORT_COL, Bytes.of(value));
   }
@@ -111,7 +111,7 @@ class ExportBucket {
    * Computes the minimial row for a bucket
    */
   private Bytes getMinimalRow() {
-    return Bytes.newBuilder(bucketRow.length() + 1).append(bucketRow).append(":").toBytes();
+    return Bytes.builder(bucketRow.length() + 1).append(bucketRow).append(":").toBytes();
   }
 
   public void notifyExportObserver() {
@@ -181,7 +181,7 @@ class ExportBucket {
 
   public void setContinueRow(ExportEntry ee) {
     Bytes nextRow =
-        Bytes.newBuilder(bucketRow.length() + 1 + ee.key.length + 8).append(bucketRow).append(":")
+        Bytes.builder(bucketRow.length() + 1 + ee.key.length + 8).append(bucketRow).append(":")
             .append(ee.key).append(encSeq(ee.seq)).toBytes();
 
     ttx.set(getMinimalRow(), NEXT_COL, nextRow);

http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java
b/modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java
index ee47b5c..8747c87 100644
--- a/modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java
+++ b/modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java
@@ -114,7 +114,7 @@ public class CollisionFreeMap<K, V> {
 
     if (nextKey != null) {
       Bytes startRow =
-          Bytes.newBuilder(ntfyRow.length() + nextKey.length()).append(ntfyRow).append(nextKey)
+          Bytes.builder(ntfyRow.length() + nextKey.length()).append(ntfyRow).append(nextKey)
               .toBytes();
       Span tmpSpan = Span.prefix(ntfyRow);
       Span nextSpan =
@@ -172,8 +172,7 @@ public class CollisionFreeMap<K, V> {
         } else {
           // start next time at the next possible key
           Bytes nextPossible =
-              Bytes.newBuilder(lastKey.length() + 1).append(lastKey).append(new byte[] {0})
-                  .toBytes();
+              Bytes.builder(lastKey.length() + 1).append(lastKey).append(new byte[] {0}).toBytes();
           tx.set(ntfyRow, NEXT_COL, nextPossible);
         }
 
@@ -198,7 +197,7 @@ public class CollisionFreeMap<K, V> {
     // TODO this is awful... no sanity check... hard to read
     dataPrefix[Bytes.of(mapId).length() + 1] = 'd';
 
-    BytesBuilder rowBuilder = Bytes.newBuilder();
+    BytesBuilder rowBuilder = Bytes.builder();
     rowBuilder.append(dataPrefix);
     int rowPrefixLen = rowBuilder.getLength();
 
@@ -293,7 +292,7 @@ public class CollisionFreeMap<K, V> {
     String bucketId = BucketUtil.genBucketId(Math.abs(hash % numBuckets), numBuckets);
 
 
-    BytesBuilder rowBuilder = Bytes.newBuilder();
+    BytesBuilder rowBuilder = Bytes.builder();
     rowBuilder.append(mapId).append(":u:").append(bucketId).append(":").append(k);
 
     Iterator<RowColumnValue> iter =
@@ -343,7 +342,7 @@ public class CollisionFreeMap<K, V> {
 
     Set<String> buckets = new HashSet<>();
 
-    BytesBuilder rowBuilder = Bytes.newBuilder();
+    BytesBuilder rowBuilder = Bytes.builder();
     rowBuilder.append(mapId).append(":u:");
     int prefixLength = rowBuilder.getLength();
 
@@ -426,7 +425,7 @@ public class CollisionFreeMap<K, V> {
       int hash = Hashing.murmur3_32().hashBytes(k).asInt();
       String bucketId = BucketUtil.genBucketId(Math.abs(hash % numBuckets), numBuckets);
 
-      BytesBuilder bb = Bytes.newBuilder();
+      BytesBuilder bb = Bytes.builder();
       Bytes row = bb.append(mapId).append(":d:").append(bucketId).append(":").append(k).toBytes();
       byte[] v = serializer.serialize(val);
 
@@ -612,7 +611,7 @@ public class CollisionFreeMap<K, V> {
   public static TableOptimizations getTableOptimizations(String mapId, SimpleConfiguration
appConfig) {
     Options opts = new Options(mapId, appConfig);
 
-    BytesBuilder rowBuilder = Bytes.newBuilder();
+    BytesBuilder rowBuilder = Bytes.builder();
     rowBuilder.append(mapId);
 
     List<Bytes> dataSplits = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/LogEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/LogEntry.java
b/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/LogEntry.java
index 9e61c4d..4848bbc 100644
--- a/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/LogEntry.java
+++ b/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/LogEntry.java
@@ -93,7 +93,7 @@ public class LogEntry {
     return "LogEntry{op=" + op + ", row=" + row + ", col=" + col + ", value=" + value + "}";
   }
 
-  public static LogEntry newGet(String row, Column col, String value) {
+  public static LogEntry newGet(CharSequence row, Column col, CharSequence value) {
     return newGet(Bytes.of(row), col, Bytes.of(value));
   }
 
@@ -101,7 +101,7 @@ public class LogEntry {
     return new LogEntry(Operation.GET, row, col, value);
   }
 
-  public static LogEntry newSet(String row, Column col, String value) {
+  public static LogEntry newSet(CharSequence row, Column col, CharSequence value) {
     return newSet(Bytes.of(row), col, Bytes.of(value));
   }
 
@@ -109,7 +109,7 @@ public class LogEntry {
     return new LogEntry(Operation.SET, row, col, value);
   }
 
-  public static LogEntry newDelete(String row, Column col) {
+  public static LogEntry newDelete(CharSequence row, Column col) {
     return newDelete(Bytes.of(row), col);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/RecordingTransactionBase.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/RecordingTransactionBase.java
b/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/RecordingTransactionBase.java
index cef060c..13e2b78 100644
--- a/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/RecordingTransactionBase.java
+++ b/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/RecordingTransactionBase.java
@@ -63,7 +63,7 @@ public class RecordingTransactionBase implements TransactionBase {
   }
 
   @Override
-  public void setWeakNotification(String row, Column col) {
+  public void setWeakNotification(CharSequence row, Column col) {
     txb.setWeakNotification(row, col);
   }
 
@@ -74,7 +74,7 @@ public class RecordingTransactionBase implements TransactionBase {
   }
 
   @Override
-  public void set(String row, Column col, String value) throws AlreadySetException {
+  public void set(CharSequence row, Column col, CharSequence value) throws AlreadySetException
{
     txLog.filteredAdd(LogEntry.newSet(row, col, value), filter);
     txb.set(row, col, value);
   }
@@ -86,7 +86,7 @@ public class RecordingTransactionBase implements TransactionBase {
   }
 
   @Override
-  public void delete(String row, Column col) {
+  public void delete(CharSequence row, Column col) {
     txLog.filteredAdd(LogEntry.newDelete(row, col), filter);
     txb.delete(row, col);
   }
@@ -342,7 +342,8 @@ public class RecordingTransactionBase implements TransactionBase {
   // TODO alot of these String methods may be more efficient if called the Byte version in
this
   // class... this would avoid conversion from Byte->String->Byte
   @Override
-  public Map<String, Map<Column, String>> gets(Collection<String> rows,
Set<Column> columns) {
+  public Map<String, Map<Column, String>> gets(Collection<? extends CharSequence>
rows,
+      Set<Column> columns) {
     Map<String, Map<Column, String>> rowColVal = txb.gets(rows, columns);
     for (Map.Entry<String, Map<Column, String>> rowEntry : rowColVal.entrySet())
{
       for (Map.Entry<Column, String> colEntry : rowEntry.getValue().entrySet()) {
@@ -354,7 +355,7 @@ public class RecordingTransactionBase implements TransactionBase {
   }
 
   @Override
-  public String gets(String row, Column col) {
+  public String gets(CharSequence row, Column col) {
     String val = txb.gets(row, col);
     if (val != null) {
       txLog.filteredAdd(LogEntry.newGet(row, col, val), filter);
@@ -363,7 +364,7 @@ public class RecordingTransactionBase implements TransactionBase {
   }
 
   @Override
-  public Map<Column, String> gets(String row, Set<Column> columns) {
+  public Map<Column, String> gets(CharSequence row, Set<Column> columns) {
     Map<Column, String> colVal = txb.gets(row, columns);
     for (Map.Entry<Column, String> entry : colVal.entrySet()) {
       txLog.filteredAdd(LogEntry.newGet(row, entry.getKey(), entry.getValue()), filter);

http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedSnapshotBase.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedSnapshotBase.java
b/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedSnapshotBase.java
index 35f87cd..c8fc105 100644
--- a/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedSnapshotBase.java
+++ b/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedSnapshotBase.java
@@ -533,17 +533,18 @@ public class TypedSnapshotBase implements SnapshotBase {
   }
 
   @Override
-  public String gets(String row, Column column) {
+  public String gets(CharSequence row, Column column) {
     return snapshot.gets(row, column);
   }
 
   @Override
-  public Map<Column, String> gets(String row, Set<Column> columns) {
+  public Map<Column, String> gets(CharSequence row, Set<Column> columns) {
     return snapshot.gets(row, columns);
   }
 
   @Override
-  public Map<String, Map<Column, String>> gets(Collection<String> rows,
Set<Column> columns) {
+  public Map<String, Map<Column, String>> gets(Collection<? extends CharSequence>
rows,
+      Set<Column> columns) {
     return snapshot.gets(rows, columns);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedTransactionBase.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedTransactionBase.java
b/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedTransactionBase.java
index 69ec694..7fa69c3 100644
--- a/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedTransactionBase.java
+++ b/modules/core/src/main/java/org/apache/fluo/recipes/core/types/TypedTransactionBase.java
@@ -252,7 +252,7 @@ public class TypedTransactionBase extends TypedSnapshotBase implements
Transacti
   }
 
   @Override
-  public void set(String row, Column col, String value) throws AlreadySetException {
+  public void set(CharSequence row, Column col, CharSequence value) throws AlreadySetException
{
     tx.set(row, col, value);
   }
 
@@ -262,7 +262,7 @@ public class TypedTransactionBase extends TypedSnapshotBase implements
Transacti
   }
 
   @Override
-  public void setWeakNotification(String row, Column col) {
+  public void setWeakNotification(CharSequence row, Column col) {
     tx.setWeakNotification(row, col);
   }
 
@@ -272,7 +272,7 @@ public class TypedTransactionBase extends TypedSnapshotBase implements
Transacti
   }
 
   @Override
-  public void delete(String row, Column col) {
+  public void delete(CharSequence row, Column col) {
     tx.delete(row, col);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockSnapshotBase.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockSnapshotBase.java
b/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockSnapshotBase.java
index e3f37e1..cf9bb31 100644
--- a/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockSnapshotBase.java
+++ b/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockSnapshotBase.java
@@ -175,17 +175,18 @@ public class MockSnapshotBase implements SnapshotBase {
 
 
   @Override
-  public String gets(String row, Column column) {
+  public String gets(CharSequence row, Column column) {
     return TxStringUtil.gets(this, row, column);
   }
 
   @Override
-  public Map<Column, String> gets(String row, Set<Column> columns) {
+  public Map<Column, String> gets(CharSequence row, Set<Column> columns) {
     return TxStringUtil.gets(this, row, columns);
   }
 
   @Override
-  public Map<String, Map<Column, String>> gets(Collection<String> rows,
Set<Column> columns) {
+  public Map<String, Map<Column, String>> gets(Collection<? extends CharSequence>
rows,
+      Set<Column> columns) {
     return TxStringUtil.gets(this, rows, columns);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-fluo-recipes/blob/91ff0776/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockTransactionBase.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockTransactionBase.java
b/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockTransactionBase.java
index 05ab87e..3532848 100644
--- a/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockTransactionBase.java
+++ b/modules/core/src/test/java/org/apache/fluo/recipes/core/types/MockTransactionBase.java
@@ -74,17 +74,17 @@ public class MockTransactionBase extends MockSnapshotBase implements Transaction
   }
 
   @Override
-  public void setWeakNotification(String row, Column col) {
+  public void setWeakNotification(CharSequence row, Column col) {
     setWeakNotification(Bytes.of(row), col);
   }
 
   @Override
-  public void set(String row, Column col, String value) throws AlreadySetException {
+  public void set(CharSequence row, Column col, CharSequence value) throws AlreadySetException
{
     set(Bytes.of(row), col, Bytes.of(value));
   }
 
   @Override
-  public void delete(String row, Column col) {
+  public void delete(CharSequence row, Column col) {
     delete(Bytes.of(row), col);
   }
 }


Mime
View raw message