public class RangeCache extends Object implements AutoCloseable, Iterable<KeyValue>
| Modifier and Type | Class and Description |
|---|---|
static interface |
RangeCache.Listener |
static class |
RangeCache.PutResult |
| Modifier and Type | Field and Description |
|---|---|
protected Executor |
listenerExecutor |
protected List<RangeCache.Listener> |
listeners |
protected static org.slf4j.Logger |
logger |
static long |
TIMEOUT_MS |
| Constructor and Description |
|---|
RangeCache(EtcdClient client,
com.google.protobuf.ByteString prefix) |
RangeCache(EtcdClient client,
com.google.protobuf.ByteString prefix,
boolean sorted) |
RangeCache(EtcdClient client,
com.google.protobuf.ByteString fromKey,
com.google.protobuf.ByteString toKey,
boolean sorted) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(RangeCache.Listener listener) |
void |
close() |
boolean |
delete(com.google.protobuf.ByteString key) |
boolean |
delete(com.google.protobuf.ByteString key,
long modRev) |
void |
forEach(Consumer<? super KeyValue> action) |
protected com.google.common.util.concurrent.ListenableFuture<Boolean> |
fullRefreshCache() |
KeyValue |
get(com.google.protobuf.ByteString key) |
KeyValue |
getFirst() |
KeyValue |
getRemote(com.google.protobuf.ByteString key) |
protected KeyValue |
getRemote(com.google.protobuf.ByteString key,
boolean weak) |
KeyValue |
getRemoteWeak(com.google.protobuf.ByteString key) |
boolean |
isClosed() |
protected static boolean |
isDeleted(KeyValue kv) |
Iterator<KeyValue> |
iterator() |
boolean |
keyExists(com.google.protobuf.ByteString key) |
boolean |
keyExistsRemote(com.google.protobuf.ByteString key) |
Set<com.google.protobuf.ByteString> |
keySet() |
protected static KeyValue |
kvOrNullIfDeleted(KeyValue fromCache) |
protected static Compare.Builder |
modRevCompare(com.google.protobuf.ByteString key,
long modRev) |
protected void |
notifyListeners(RangeCache.Listener.EventType type,
KeyValue keyValue,
boolean inListenerExecutor) |
protected KeyValue |
offerDelete(com.google.protobuf.ByteString key,
long modRevision) |
protected KeyValue |
offerExpiry(com.google.protobuf.ByteString key)
Deprecated.
|
protected KeyValue |
offerUpdate(KeyValue keyValue,
boolean watchThread) |
long |
put(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value) |
RangeCache.PutResult |
put(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long modRev) |
RangeCache.PutResult |
put(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long lease,
CompareOrBuilder... conditions) |
RangeCache.PutResult |
put(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long leaseId,
long modRev) |
long |
putNoGet(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long modRev) |
long |
putNoGet(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long lease,
CompareOrBuilder... conditions) |
long |
putNoGet(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long leaseId,
long modRev) |
protected TxnRequest |
putTxn(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
boolean getOnFail,
long lease,
CompareOrBuilder... conditions) |
boolean |
removeListener(RangeCache.Listener listener) |
protected void |
revisionUpdate(long upToRev) |
int |
size() |
com.google.common.util.concurrent.ListenableFuture<Boolean> |
start() |
Iterator<KeyValue> |
strongIterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitspliteratorprotected static final org.slf4j.Logger logger
public static final long TIMEOUT_MS
protected final List<RangeCache.Listener> listeners
protected final Executor listenerExecutor
public RangeCache(EtcdClient client, com.google.protobuf.ByteString prefix)
public RangeCache(EtcdClient client, com.google.protobuf.ByteString prefix, boolean sorted)
public RangeCache(EtcdClient client, com.google.protobuf.ByteString fromKey, com.google.protobuf.ByteString toKey, boolean sorted)
public com.google.common.util.concurrent.ListenableFuture<Boolean> start()
protected com.google.common.util.concurrent.ListenableFuture<Boolean> fullRefreshCache()
protected void revisionUpdate(long upToRev)
public void addListener(RangeCache.Listener listener)
public boolean removeListener(RangeCache.Listener listener)
protected void notifyListeners(RangeCache.Listener.EventType type, KeyValue keyValue, boolean inListenerExecutor)
protected KeyValue offerExpiry(com.google.protobuf.ByteString key)
protected KeyValue offerDelete(com.google.protobuf.ByteString key, long modRevision)
protected static boolean isDeleted(KeyValue kv)
public KeyValue get(com.google.protobuf.ByteString key)
public KeyValue getFirst()
protected KeyValue getRemote(com.google.protobuf.ByteString key, boolean weak)
public KeyValue getRemote(com.google.protobuf.ByteString key)
public KeyValue getRemoteWeak(com.google.protobuf.ByteString key)
public int size()
public boolean keyExists(com.google.protobuf.ByteString key)
public boolean keyExistsRemote(com.google.protobuf.ByteString key)
public long put(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value)
public RangeCache.PutResult put(com.google.protobuf.ByteString key, com.google.protobuf.ByteString value, long lease, CompareOrBuilder... conditions)
public RangeCache.PutResult put(com.google.protobuf.ByteString key, com.google.protobuf.ByteString value, long modRev)
public RangeCache.PutResult put(com.google.protobuf.ByteString key, com.google.protobuf.ByteString value, long leaseId, long modRev)
public long putNoGet(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long lease,
CompareOrBuilder... conditions)
public long putNoGet(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long modRev)
public long putNoGet(com.google.protobuf.ByteString key,
com.google.protobuf.ByteString value,
long leaseId,
long modRev)
protected static Compare.Builder modRevCompare(com.google.protobuf.ByteString key, long modRev)
protected TxnRequest putTxn(com.google.protobuf.ByteString key, com.google.protobuf.ByteString value, boolean getOnFail, long lease, CompareOrBuilder... conditions)
public boolean delete(com.google.protobuf.ByteString key)
public boolean delete(com.google.protobuf.ByteString key,
long modRev)
public Set<com.google.protobuf.ByteString> keySet()
public void close()
public boolean isClosed()
Copyright © 2019. All rights reserved.