private TableWriteFunction<?, ?> getWriteFn(JavaTableConfig tableConfig) { TableWriteFunction<?, ?> writeFn = deserializeObject(tableConfig, RemoteTableDescriptor.WRITE_FN); if (writeFn != null) { writeFn.init(this.context); } return writeFn; }
/** * Throttle a request with a key argument if necessary. * @param key key used for the table request */ public void throttle(K key) { throttle(getCredits(key, null)); }
/** * Throttle a request with a collection of table records as the argument if necessary. * @param records collection of records used for the table request */ public void throttleRecords(Collection<Entry<K, V>> records) { throttle(getEntryCredits(records)); } }
@Test public void testPutAsync() { verifyFailure(() -> roTable.putAsync(1, 2)); rwTable.putAsync(1, 2); verify(writeFn, times(1)).putAsync(any(), any()); }
private TableReadFunction<?, ?> getReadFn(JavaTableConfig tableConfig) { TableReadFunction<?, ?> readFn = deserializeObject(tableConfig, RemoteTableDescriptor.READ_FN); if (readFn != null) { readFn.init(this.context); } return readFn; }
/** * {@inheritDoc} */ @Override public void close() { readFn.close(); }
@Override public void flush() { if (writeFn != null) { writeFn.flush(); } }
@Override public TableProvider getTableProvider(String tableId) { return new RemoteTableProvider(tableId); } }
/** * Throttle a request with a collection of keys as the argument if necessary. * @param keys collection of keys used for the table request */ public void throttle(Collection<K> keys) { throttle(getCredits(keys)); }
/** * {@inheritDoc} */ @Override public void close() { readFn.close(); }
/** * Throttle a request with both the key and value arguments if necessary. * @param key key used for the table request * @param value value used for the table request */ public void throttle(K key, V value) { throttle(getCredits(key, value)); }
/** * Throttle a request with a collection of keys as the argument if necessary. * @param keys collection of keys used for the table request */ public void throttle(Collection<K> keys) { throttle(getCredits(keys)); }