@Override public CompletableFuture<Void> deleteAsync(K key) { CompletableFuture<Void> future = new CompletableFuture(); try { delete(key); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public CompletableFuture<Void> deleteAllAsync(List<K> keys) { CompletableFuture<Void> future = new CompletableFuture(); try { deleteAll(keys); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public CompletableFuture<Void> putAsync(K key, V value) { CompletableFuture<Void> future = new CompletableFuture(); try { put(key, value); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public CompletableFuture<Void> putAllAsync(List<Entry<K, V>> entries) { CompletableFuture<Void> future = new CompletableFuture(); try { putAll(entries); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public Table getTable() { if (kvStore == null) { throw new SamzaException("Store not initialized for table " + tableSpec.getId()); } ReadableTable table = new LocalStoreBackedReadWriteTable(tableSpec.getId(), kvStore); table.init(this.context); return table; }
@Override public CompletableFuture<Void> putAllAsync(List<Entry<K, V>> entries) { CompletableFuture<Void> future = new CompletableFuture(); try { putAll(entries); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public Table getTable() { if (kvStore == null) { throw new SamzaException("Store not initialized for table " + tableSpec.getId()); } ReadableTable table = new LocalStoreBackedReadWriteTable(tableSpec.getId(), kvStore); table.init(this.context); return table; }
@Override public CompletableFuture<Void> deleteAsync(K key) { CompletableFuture<Void> future = new CompletableFuture(); try { delete(key); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public CompletableFuture<Void> deleteAllAsync(List<K> keys) { CompletableFuture<Void> future = new CompletableFuture(); try { deleteAll(keys); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public CompletableFuture<Void> putAsync(K key, V value) { CompletableFuture<Void> future = new CompletableFuture(); try { put(key, value); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
@Override public void put(K key, V value) { if (value != null) { writeMetrics.numPuts.inc(); long startNs = System.nanoTime(); kvStore.put(key, value); writeMetrics.putNs.update(System.nanoTime() - startNs); } else { delete(key); } }
@Override public void put(K key, V value) { if (value != null) { writeMetrics.numPuts.inc(); long startNs = System.nanoTime(); kvStore.put(key, value); writeMetrics.putNs.update(System.nanoTime() - startNs); } else { delete(key); } }