Repository: incubator-fluo Updated Branches: refs/heads/master 2b1c45605 -> 0373ec549
Fixes #770 added Column varargs to transaction Project: http://git-wip-us.apache.org/repos/asf/incubator-fluo/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fluo/commit/7fa52961 Tree: http://git-wip-us.apache.org/repos/asf/incubator-fluo/tree/7fa52961 Diff: http://git-wip-us.apache.org/repos/asf/incubator-fluo/diff/7fa52961 Branch: refs/heads/master Commit: 7fa52961172c16b5d6f9733cf8c9d54a01ae05a6 Parents: dcfd1a7 Author: Keith Turner <ke...@deenlo.com> Authored: Thu Sep 15 11:58:24 2016 -0400 Committer: Keith Turner <ke...@deenlo.com> Committed: Thu Sep 15 11:58:24 2016 -0400 ---------------------------------------------------------------------- .../apache/fluo/api/client/SnapshotBase.java | 42 ++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/7fa52961/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java ---------------------------------------------------------------------- diff --git a/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java b/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java index b0e61f2..0bc3837 100644 --- a/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java +++ b/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java @@ -19,6 +19,7 @@ import java.util.Collection; import java.util.Map; import java.util.Set; +import com.google.common.collect.ImmutableSet; import org.apache.fluo.api.client.scanner.ScannerBuilder; import org.apache.fluo.api.data.Bytes; import org.apache.fluo.api.data.Column; @@ -39,18 +40,36 @@ public interface SnapshotBase { Bytes get(Bytes row, Column column); /** - * Given a row and set of {@link Column}s, retrieves a map contains the values at those + * Given a row and set of {@link Column}s, retrieves a map that contains the values at those * {@link Column}s. Only columns that exist will be returned in map. */ Map<Column, Bytes> get(Bytes row, Set<Column> columns); /** - * Given a collection of rows and set of {@link Column}s, retrieves a map contains the values at - * those rows and {@link Column}s. Only rows and columns that exists will be returned in map. + * Given a row and list of {@link Column}s, retrieves a map that contains the values at those + * {@link Column}s. Only columns that exist will be returned in map. + */ + default Map<Column, Bytes> get(Bytes row, Column... columns) { + return get(row, ImmutableSet.copyOf(columns)); + } + + /** + * Given a collection of rows and set of {@link Column}s, retrieves a map that contains the values + * at those rows and {@link Column}s. Only rows and columns that exists will be returned in map. */ Map<Bytes, Map<Column, Bytes>> get(Collection<Bytes> rows, Set<Column> columns); /** + * Given a collection of rows and list of {@link Column}s, retrieves a map that contains the + * values at those rows and {@link Column}s. Only rows and columns that exists will be returned in + * map. + */ + default Map<Bytes, Map<Column, Bytes>> get(Collection<Bytes> rows, Column... columns) { + return get(rows, ImmutableSet.copyOf(columns)); + } + + + /** * Given a collection of {@link RowColumn}s, retrieves a map contains the values at * {@link RowColumn}. Only rows and columns that exists will be returned in map. */ @@ -108,6 +127,15 @@ public interface SnapshotBase { Map<String, Map<Column, String>> gets(Collection<? extends CharSequence> rows, Set<Column> columns); /** + * Wrapper for {@link #get(Collection, Set)} that uses Strings. All strings are encoded and + * decoded using UTF-8. + */ + default Map<String, Map<Column, String>> gets(Collection<? extends CharSequence> rows, + Column... columns) { + return gets(rows, ImmutableSet.copyOf(columns)); + } + + /** * Wrapper for {@link #get(Bytes, Column)} that uses Strings. All strings are encoded and decoded * using UTF-8. */ @@ -120,6 +148,14 @@ public interface SnapshotBase { Map<Column, String> gets(CharSequence row, Set<Column> columns); /** + * Wrapper for {@link #get(Bytes, Set)} that uses Strings. All strings are encoded and decoded + * using UTF-8. + */ + default Map<Column, String> gets(CharSequence row, Column... columns) { + return gets(row, ImmutableSet.copyOf(columns)); + } + + /** * @return transactions start timestamp allocated from Oracle. */ long getStartTimestamp();