public class WriteBehindStore extends AbstractMapDataStore<Data,Object>
Modifier and Type | Class and Description |
---|---|
static class |
WriteBehindStore.Sequence
The purpose of this class is to provide distinction
between flushes caused by eviction and
IMap.flush() |
nodeEngine
Constructor and Description |
---|
WriteBehindStore(MapStoreContext mapStoreContext,
int partitionId,
WriteBehindProcessor writeBehindProcessor) |
Modifier and Type | Method and Description |
---|---|
Object |
add(Data key,
Object value,
long expirationTime,
long now,
UUID transactionId) |
void |
add(DelayedEntry<Data,Object> delayedEntry) |
Object |
addBackup(Data key,
Object value,
long expirationTime,
long time,
UUID transactionId)
Throw no exception while putting backup entry.
|
void |
addForcibly(DelayedEntry<Data,Object> delayedEntry)
Adds delayed-entry without doing capacity checks.
|
void |
addTransient(Data key,
long now) |
Object |
flush(Data key,
Object value,
boolean backup)
Flushes the supplied key to the map-store.
|
Queue<WriteBehindStore.Sequence> |
getFlushSequences() |
long |
getSequenceToFlush() |
TxnReservedCapacityCounter |
getTxnReservedCapacityCounter() |
WriteBehindQueue<DelayedEntry> |
getWriteBehindQueue() |
void |
hardFlush()
Flushes write-behind-queue into map-store in calling thread.
|
Object |
load(Data key) |
boolean |
loadable(Data key)
Used in
IMap.loadAll(boolean) calls. |
Map |
loadAll(Collection keys)
Loads values for the provided keys if a
MapLoader is
configured for this map. |
int |
notFinishedOperationsCount() |
void |
notifyFlush() |
void |
remove(Data key,
long now,
UUID transactionId) |
void |
removeBackup(Data key,
long time,
UUID transactionId) |
protected void |
removeFromStagingArea(DelayedEntry delayedEntry) |
void |
reset()
Returns all associated resources of this
map-data-store back to the initial state.
|
void |
setFlushSequences(Queue<WriteBehindStore.Sequence> flushSequences) |
void |
setSequence(long newSequence) |
long |
softFlush()
Only marks this
MapDataStore as flush-able. |
getStore, getUserExpirationTime, isPostProcessingMapStore, isWithExpirationTime, removeAll, toHeapData, toObject
public WriteBehindStore(MapStoreContext mapStoreContext, int partitionId, WriteBehindProcessor writeBehindProcessor)
public TxnReservedCapacityCounter getTxnReservedCapacityCounter()
getTxnReservedCapacityCounter
in interface MapDataStore<Data,Object>
getTxnReservedCapacityCounter
in class AbstractMapDataStore<Data,Object>
public void addForcibly(DelayedEntry<Data,Object> delayedEntry)
MapDataStore
public void add(DelayedEntry<Data,Object> delayedEntry)
public void addTransient(Data key, long now)
public Object addBackup(Data key, Object value, long expirationTime, long time, UUID transactionId)
public void reset()
MapDataStore
public Map loadAll(Collection keys)
MapLoader
is
configured for this map. This method never returns null
.
The returned map will contain deserialised keys and values.
The method first checks if some of the keys to be loaded
have entries that are staged to be persisted to the
underlying store and returns those values instead of loading
the values from the store.
The keys which don't have staged entries to be persisted will
be loaded from the underlying store.loadAll
in interface MapDataStore<Data,Object>
loadAll
in class AbstractMapDataStore<Data,Object>
keys
- the keys for which values are loadedMapLoader.loadAll(Collection)
public boolean loadable(Data key)
MapDataStore
IMap.loadAll(boolean)
calls. If the
write-behind map-store feature is enabled, some
things may lead to possible data inconsistencies.
These are:
- calling evict/evictAll,
- calling remove, and
- not yet stored write-behind queue operations.
With this method, we can be sure if a key can be loadable from map-store or not.
key
- the key to query whether it is loadable or nottrue
if the key is loadablepublic int notFinishedOperationsCount()
public Object flush(Data key, Object value, boolean backup)
MapDataStore
key
- key to be flushedvalue
- value to be flushedbackup
- true
calling this method for
backup partition, false
for owner partition.public long softFlush()
MapDataStore
MapDataStore
as flush-able. Flush
means storing entries from write-behind-queue into map-store
regardless of the scheduled store-time. Actual flushing is done
by another thread than partition-operation thread which runs
StoreWorker
.MapFlushOperation
public void hardFlush()
MapDataStore
After calling of this method, all elements in the WriteBehindQueue
of this MapDataStore
should be in
map-store regardless of the scheduled store-time.
The only call to this method is in node-shutdown.
MapManagedService.shutdown(boolean)
public WriteBehindQueue<DelayedEntry> getWriteBehindQueue()
public void setSequence(long newSequence)
public void notifyFlush()
protected void removeFromStagingArea(DelayedEntry delayedEntry)
public Queue<WriteBehindStore.Sequence> getFlushSequences()
public long getSequenceToFlush()
public void setFlushSequences(Queue<WriteBehindStore.Sequence> flushSequences)
Copyright © 2019 Hazelcast, Inc.. All rights reserved.