fluo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [fluo] branch master updated: Fixes #923 added span convenience methods to scanner builder (#940)
Date Tue, 17 Oct 2017 01:22:42 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/fluo.git


The following commit(s) were added to refs/heads/master by this push:
     new c737df6  Fixes #923 added span convenience methods to scanner builder  (#940)
c737df6 is described below

commit c737df63acac07cf7f2ba4c7f6aaebe6a6b8a440
Author: Joseph Koshakow <jkosh44@users.noreply.github.com>
AuthorDate: Mon Oct 16 21:22:40 2017 -0400

    Fixes #923 added span convenience methods to scanner builder  (#940)
    
    * Added the following default methods to the ScannerBuilder interface:
      default ScannerBuilder over(Bytes row) {...}
      default ScannerBuilder over(CharSequence row) {...}
      default ScannerBuilder over(Bytes row, Column col){...}
      default ScannerBuilder over(CharSequence row, , Column col){...}
    
      default ScannerBuilder overPrefix(Bytes row) {...}
      default ScannerBuilder overPrefix(CharSequence row){...}
      default ScannerBuilder overPrefix(Bytes row, Column col){...}
      default ScannerBuilder overPrefix(CharSequence row, , Column col){...}
    
    * Changed tests in the following classes to use the new over() and overprefix() methods
      ScannerIT
      WeakNotificationIT
      WorkerIT
      FluoIT
      LogIT
    
    * Moved @since tag to the bottom of javadoc info.
    Changed param rowPrefix to row, and updated javadocs for the following methods:
      overPrefix(Bytes, Column){...}
      overPrefix(CharSequence, Column){...}
    Removed use of Bytes.of(String) calls within over() calls from FloutIT tests
    
    * fixed javadoc errors
---
 .../fluo/api/client/scanner/ScannerBuilder.java    | 91 ++++++++++++++++++++++
 .../org/apache/fluo/integration/impl/FluoIT.java   |  6 +-
 .../apache/fluo/integration/impl/ScannerIT.java    |  5 +-
 .../fluo/integration/impl/WeakNotificationIT.java  |  3 +-
 .../org/apache/fluo/integration/impl/WorkerIT.java |  3 +-
 .../org/apache/fluo/integration/log/LogIT.java     |  8 +-
 6 files changed, 101 insertions(+), 15 deletions(-)

diff --git a/modules/api/src/main/java/org/apache/fluo/api/client/scanner/ScannerBuilder.java
b/modules/api/src/main/java/org/apache/fluo/api/client/scanner/ScannerBuilder.java
index 1217aa0..d0714cf 100644
--- a/modules/api/src/main/java/org/apache/fluo/api/client/scanner/ScannerBuilder.java
+++ b/modules/api/src/main/java/org/apache/fluo/api/client/scanner/ScannerBuilder.java
@@ -17,6 +17,7 @@ package org.apache.fluo.api.client.scanner;
 
 import java.util.Collection;
 
+import org.apache.fluo.api.data.Bytes;
 import org.apache.fluo.api.data.Column;
 import org.apache.fluo.api.data.Span;
 
@@ -30,6 +31,96 @@ public interface ScannerBuilder {
    */
   ScannerBuilder over(Span span);
 
+  /**
+  *
+  * @since 1.2.0
+  * @see org.apache.fluo.api.data.Span#exact(Bytes)
+  * @param row restrict the scanner to data in an exact row
+  * @return self
+  */
+  default ScannerBuilder over(Bytes row) {
+    return over(Span.exact(row));
+  }
+
+  /**
+  *
+  * @since 1.2.0
+  * @see org.apache.fluo.api.data.Span#exact(CharSequence)
+  * @param row restrict the scanner to data in an exact row. String parameters will be encoded
as UTF-8
+  * @return self
+  */
+  default ScannerBuilder over(CharSequence row) {
+    return over(Span.exact(row));
+  }
+
+  /**
+  *
+  * @see org.apache.fluo.api.data.Span#exact(Bytes, Column)
+  * @param row restrict the scanner to data in an exact row 
+  * @param col restrict the scanner to data in exact {@link org.apache.fluo.api.data.Column}.
+  * @since 1.2.0
+  */
+  default ScannerBuilder over(Bytes row, Column col) {
+    return over(Span.exact(row, col));
+  }
+
+  /**
+  *
+  * @see org.apache.fluo.api.data.Span#exact(CharSequence, Column)
+  * @param row restrict the scanner to data in an exact row
+  * @param col restrict the scanner to data in exact {@link org.apache.fluo.api.data.Column}.

+  * @return self
+  * @since 1.2.0
+  */
+  default ScannerBuilder over(CharSequence row, Column col) {
+    return over(Span.exact(row, col));
+  }
+
+  /**
+  *
+  * @see org.apache.fluo.api.data.Span#prefix(Bytes)
+  * @param rowPrefix restrict the scanner to data in rows that begins with a prefix
+  * @return self
+  * @since 1.2.0
+  */
+  default ScannerBuilder overPrefix(Bytes rowPrefix) {
+    return over(Span.prefix(rowPrefix));
+  }
+
+  /**
+  *
+  * @see org.apache.fluo.api.data.Span#prefix(CharSequence)
+  * @param rowPrefix restrict the scanner to data in rows that begins with a prefix.
+  * @return self
+  * @since 1.2.0
+  */
+  default ScannerBuilder overPrefix(CharSequence rowPrefix) {
+    return over(Span.prefix(rowPrefix));
+  }
+
+  /**
+  *
+  * @see org.apache.fluo.api.data.Span#prefix(Bytes, Column)
+  * @param row restrict the scanner to data in an exact row. 
+  * @param colPrefix restrict scanner to data that begins with specifiec {@link org.apache.fluo.api.data.Column}
prefix.
+  * @return self
+  * @since 1.2.0
+  */
+  default ScannerBuilder overPrefix(Bytes row, Column colPrefix) {
+    return over(Span.prefix(row, colPrefix));
+  }
+
+  /**
+  *
+  * @see org.apache.fluo.api.data.Span#prefix(CharSequence, Column)
+  * @param row restrict the scanner to data in an exact row.
+  * @param colPrefix restrict scanner to data that begins with specifiec {@link org.apache.fluo.api.data.Column}
prefix.
+  * @return self
+  * @since 1.2.0
+  */
+  default ScannerBuilder overPrefix(CharSequence row, Column colPrefix) {
+    return over(Span.prefix(row, colPrefix));
+  }
 
   /**
    * Passing in a Column with only the family set will fetch the entire column family.
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/impl/FluoIT.java
b/modules/integration/src/test/java/org/apache/fluo/integration/impl/FluoIT.java
index b1352ee..bd17025 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/impl/FluoIT.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/impl/FluoIT.java
@@ -463,8 +463,7 @@ public class FluoIT extends ITBaseImpl {
 
     HashSet<Column> columns = new HashSet<>();
 
-    CellScanner cellScanner =
-        tx2.scanner().over(Span.exact(Bytes.of("d00001"))).fetch(new Column("outlink")).build();
+    CellScanner cellScanner = tx2.scanner().over("d00001").fetch(new Column("outlink")).build();
     for (RowColumnValue rcv : cellScanner) {
       columns.add(rcv.getColumn());
     }
@@ -480,8 +479,7 @@ public class FluoIT extends ITBaseImpl {
 
     TestTransaction tx4 = new TestTransaction(env);
     columns.clear();
-    cellScanner =
-        tx4.scanner().over(Span.exact(Bytes.of("d00001"))).fetch(new Column("outlink")).build();
+    cellScanner = tx4.scanner().over("d00001").fetch(new Column("outlink")).build();
     for (RowColumnValue rcv : cellScanner) {
       columns.add(rcv.getColumn());
     }
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/impl/ScannerIT.java
b/modules/integration/src/test/java/org/apache/fluo/integration/impl/ScannerIT.java
index e8af4c7..f9cb31e 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/impl/ScannerIT.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/impl/ScannerIT.java
@@ -67,12 +67,11 @@ public class ScannerIT extends ITBaseImpl {
 
     try (Snapshot snap = client.newSnapshot()) {
       HashSet<RowColumnValue> actual = new HashSet<>();
-      Iterables.addAll(actual, snap.scanner().over(Span.exact("r2")).build());
+      Iterables.addAll(actual, snap.scanner().over("r2").build());
       Assert.assertEquals(expectedR2, actual);
 
       actual.clear();
-      Iterables.addAll(actual,
-          snap.scanner().over(Span.exact("r2")).fetch(new Column("f1", "q2")).build());
+      Iterables.addAll(actual, snap.scanner().over("r2").fetch(new Column("f1", "q2")).build());
       Assert.assertEquals(expectedR2c, actual);
 
       actual.clear();
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/impl/WeakNotificationIT.java
b/modules/integration/src/test/java/org/apache/fluo/integration/impl/WeakNotificationIT.java
index 52803ef..3add9b5 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/impl/WeakNotificationIT.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/impl/WeakNotificationIT.java
@@ -44,8 +44,7 @@ public class WeakNotificationIT extends ITBaseMini {
     @Override
     public void process(TransactionBase tx, Bytes row, Column col) throws Exception {
 
-      CellScanner cellScanner =
-          tx.scanner().over(Span.exact(row, new Column(Bytes.of("stats")))).build();
+      CellScanner cellScanner = tx.scanner().over(row, new Column(Bytes.of("stats"))).build();
 
       int sum = 0;
 
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/impl/WorkerIT.java
b/modules/integration/src/test/java/org/apache/fluo/integration/impl/WorkerIT.java
index c1ea66f..6347a24 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/impl/WorkerIT.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/impl/WorkerIT.java
@@ -56,8 +56,7 @@ public class WorkerIT extends ITBaseMini {
       String degree = tx.gets(row, DEGREE);
 
       // calculate new degree
-      String degree2 =
-          "" + Iterables.size(tx.scanner().over(Span.exact(row, new Column("link"))).build());
+      String degree2 = "" + Iterables.size(tx.scanner().over(row, new Column("link")).build());
 
       if (degree == null || !degree.equals(degree2)) {
         tx.set(row, DEGREE, degree2);
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/log/LogIT.java
b/modules/integration/src/test/java/org/apache/fluo/integration/log/LogIT.java
index a4749f3..cca2c21 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/log/LogIT.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/log/LogIT.java
@@ -513,10 +513,10 @@ public class LogIT extends ITBaseMini {
         CellScanner scanner1 = snap.scanner().build();
         assertEqual(scanner1, rcv1, rcv2, rcv3, rcv4);
 
-        CellScanner scanner2 = snap.scanner().over(Span.exact("r1")).build();
+        CellScanner scanner2 = snap.scanner().over("r1").build();
         assertEqual(scanner2, rcv1, rcv2);
 
-        CellScanner scanner3 = snap.scanner().over(Span.exact("r1")).fetch(c1).build();
+        CellScanner scanner3 = snap.scanner().over("r1").fetch(c1).build();
         assertEqual(scanner3, rcv1);
 
         CellScanner scanner4 = snap.scanner().fetch(c1).build();
@@ -527,10 +527,10 @@ public class LogIT extends ITBaseMini {
         RowScanner rowScanner1 = snap.scanner().byRow().build();
         assertEqual(rowScanner1, "r1", c1, "v1", c2, "v2", "r2", c1, "v3", c2, "v4");
 
-        RowScanner rowScanner2 = snap.scanner().over(Span.exact("r1")).byRow().build();
+        RowScanner rowScanner2 = snap.scanner().over("r1").byRow().build();
         assertEqual(rowScanner2, "r1", c1, "v1", c2, "v2");
 
-        RowScanner rowScanner3 = snap.scanner().over(Span.exact("r1")).fetch(c1).byRow().build();
+        RowScanner rowScanner3 = snap.scanner().over("r1").fetch(c1).byRow().build();
         assertEqual(rowScanner3, "r1", c1, "v1");
 
         RowScanner rowScanner4 = snap.scanner().fetch(c1).byRow().build();

-- 
To stop receiving notification emails like this one, please contact
['"commits@fluo.apache.org" <commits@fluo.apache.org>'].

Mime
View raw message