public class ReadWriteSpannerView extends MutableView implements CloseableKVStore
KVStore view of a ReadContext.
For best performance, supply an ExecutorService for asynchronous batch loading.
Use bufferMutations() to transfer outstanding mutations into a TransactionContext.
ReadOnlySpannerView,
BatchingKVStore| Modifier and Type | Field and Description |
|---|---|
protected Function<? super SpannerException,RuntimeException> |
exceptionMapper |
protected Logger |
log |
protected String |
tableName |
| Constructor and Description |
|---|
ReadWriteSpannerView(String tableName,
ReadContext context,
Function<? super SpannerException,RuntimeException> exceptionMapper)
Constructor for when no batching is desired.
|
ReadWriteSpannerView(String tableName,
ReadContext context,
Function<? super SpannerException,RuntimeException> exceptionMapper,
ExecutorService executor,
int rttEstimate)
Constructor for when batching is desired.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bufferMutations(TransactionContext context)
Atomically transfer all of the outstanding mutations associated with this instance into the given transaction context,
and then clear them.
|
ReadWriteSpannerView |
clone() |
void |
close()
Close the associated
ReadContext. |
adjustCounter, decodeCounter, disableReadTracking, encodeCounter, get, getKVStore, getRange, getReads, getWrites, put, remove, removeRange, setKVStore, setReadOnly, toStringgetAtLeast, getAtMostequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadjustCounter, decodeCounter, encodeCounter, get, getAtLeast, getAtMost, getRange, getRange, getRange, put, remove, removeRangeprotected final Logger log
protected final String tableName
protected final Function<? super SpannerException,RuntimeException> exceptionMapper
public ReadWriteSpannerView(String tableName, ReadContext context, Function<? super SpannerException,RuntimeException> exceptionMapper)
tableName - name of the Spanner database tablecontext - read contextexceptionMapper - mapper for any thrown SpannerExceptions, or null for noneIllegalArgumentException - if tableName or context is nullpublic ReadWriteSpannerView(String tableName, ReadContext context, Function<? super SpannerException,RuntimeException> exceptionMapper, ExecutorService executor, int rttEstimate)
tableName - name of the Spanner database tablecontext - read contextexceptionMapper - mapper for any thrown SpannerExceptions, or null for noneexecutor - asynchronous load task executorrttEstimate - initial RTT estimate in millisecondsIllegalArgumentException - if tableName, context or executor is nullpublic void bufferMutations(TransactionContext context)
context - transaction contextIllegalArgumentException - if context is nullpublic ReadWriteSpannerView clone()
clone in class MutableViewpublic void close()
ReadContext.close in interface Closeableclose in interface AutoCloseableclose in interface CloseableKVStoreCopyright © 2017. All rights reserved.