public class ReadOnlySpannerView extends AbstractKVStore implements CloseableKVStore
KVStore view of a ReadContext.
For best performance, consider wrapping an instance of this class in a BatchingKVStore.
ReadWriteSpannerView| Modifier and Type | Field and Description |
|---|---|
protected ReadContext |
context |
protected Function<? super SpannerException,RuntimeException> |
exceptionMapper |
protected Logger |
log |
protected String |
tableName |
| Constructor and Description |
|---|
ReadOnlySpannerView(String tableName,
ReadContext context)
Convenience constructor.
|
ReadOnlySpannerView(String tableName,
ReadContext context,
Function<? super SpannerException,RuntimeException> exceptionMapper)
Primary constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the associated
ReadContext. |
byte[] |
get(byte[] key) |
KVPair |
getAtLeast(byte[] minKey,
byte[] maxKey) |
KVPair |
getAtMost(byte[] maxKey,
byte[] minKey) |
CloseableIterator<KVPair> |
getRange(byte[] minKey,
byte[] maxKey,
boolean reverse) |
protected static KVPair |
kv(Struct struct) |
void |
put(byte[] key,
byte[] value) |
void |
remove(byte[] key) |
void |
removeRange(byte[] minKey,
byte[] maxKey) |
adjustCounter, decodeCounter, encodeCounterclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadjustCounter, decodeCounter, encodeCounter, getRange, getRangeprotected final Logger log
protected final String tableName
protected final ReadContext context
protected final Function<? super SpannerException,RuntimeException> exceptionMapper
public ReadOnlySpannerView(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 ReadOnlySpannerView(String tableName, ReadContext context)
Equivalent to ReadOnlySpannerView(tableName, context, null).
tableName - name of the Spanner database tablecontext - read contextIllegalArgumentException - if tableName or context is nullpublic byte[] get(byte[] key)
get in interface KVStoreget in class AbstractKVStorepublic KVPair getAtLeast(byte[] minKey, byte[] maxKey)
getAtLeast in interface KVStoregetAtLeast in class AbstractKVStorepublic KVPair getAtMost(byte[] maxKey, byte[] minKey)
getAtMost in interface KVStoregetAtMost in class AbstractKVStorepublic CloseableIterator<KVPair> getRange(byte[] minKey, byte[] maxKey, boolean reverse)
public void put(byte[] key,
byte[] value)
put in interface KVStoreput in class AbstractKVStorepublic void remove(byte[] key)
remove in interface KVStoreremove in class AbstractKVStorepublic void removeRange(byte[] minKey,
byte[] maxKey)
removeRange in interface KVStoreremoveRange in class AbstractKVStorepublic void close()
ReadContext.close in interface Closeableclose in interface AutoCloseableclose in interface CloseableKVStoreCopyright © 2017. All rights reserved.