You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by we...@apache.org on 2019/05/03 21:42:41 UTC

[samza] branch master updated: SAMZA-2184: Expose range/snapshot/all() in local table

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 1531762  SAMZA-2184: Expose range/snapshot/all() in local table
1531762 is described below

commit 1531762074e1c83c1ee72891f210c6ba25579865
Author: Wei Song <ws...@linkedin.com>
AuthorDate: Fri May 3 14:42:32 2019 -0700

    SAMZA-2184: Expose range/snapshot/all() in local table
    
    Introduce range() and snapshot() in local table to achieve feature parity between storage store and local table.
    
    Author: Wei Song <ws...@linkedin.com>
    
    Reviewers: Dengpan Yin <dy...@linkedin.com>
    
    Closes #1020 from weisong44/SAMZA-2184
---
 .../org/apache/samza/storage/kv/LocalTable.java    | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/samza-kv/src/main/java/org/apache/samza/storage/kv/LocalTable.java b/samza-kv/src/main/java/org/apache/samza/storage/kv/LocalTable.java
index 83810c9..a269452 100644
--- a/samza-kv/src/main/java/org/apache/samza/storage/kv/LocalTable.java
+++ b/samza-kv/src/main/java/org/apache/samza/storage/kv/LocalTable.java
@@ -180,6 +180,39 @@ public class LocalTable<K, V> extends BaseReadWriteTable<K, V> {
     return future;
   }
 
+  /**
+   * Refer to {@link KeyValueStore#range(Object, Object)}
+   *
+   * @param from the key specifying the low endpoint (inclusive) of the keys in the returned range.
+   * @param to the key specifying the high endpoint (exclusive) of the keys in the returned range.
+   * @return an iterator for the specified key range.
+   * @throws NullPointerException if null is used for {@code from} or {@code to}.
+   */
+  public KeyValueIterator<K, V> range(K from, K to) {
+    return kvStore.range(from, to);
+  }
+
+  /**
+   * Refer to {@link KeyValueStore#snapshot(Object, Object)}
+   *
+   * @param from the key specifying the low endpoint (inclusive) of the keys in the returned range.
+   * @param to the key specifying the high endpoint (exclusive) of the keys in the returned range.
+   * @return a snapshot for the specified key range.
+   * @throws NullPointerException if null is used for {@code from} or {@code to}.
+   */
+  public KeyValueSnapshot<K, V> snapshot(K from, K to) {
+    return kvStore.snapshot(from, to);
+  }
+
+  /**
+   * Refer to {@link KeyValueStore#all()}
+   *
+   * @return an iterator for all entries in this key-value store.
+   */
+  public KeyValueIterator<K, V> all() {
+    return kvStore.all();
+  }
+
   @Override
   public void flush() {
     // Since the KV store will be flushed by task storage manager, only update metrics here