public interface RecordStore<R extends Record> extends LocalRecordStoreStats
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TTL
Default TTL value of a record.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canAcquireLock(Data key,
String caller,
long threadId) |
void |
checkIfLoaded() |
int |
clear() |
void |
clearPartition(boolean onShutdown)
Clears internal partition data.
|
boolean |
containsKey(Data dataKey) |
boolean |
containsValue(Object testValue) |
Record |
createRecord(Object value,
long ttlMillis,
long now) |
Storage |
createStorage(RecordFactory<R> recordFactory,
InMemoryFormat memoryFormat) |
boolean |
delete(Data dataKey) |
void |
destroy() |
void |
disposeDeferredBlocks()
This can be used to release unused resources.
|
void |
doPostEvictionOperations(Record record,
boolean backup)
Does post eviction operations like sending events
|
Object |
evict(Data key,
boolean backup) |
int |
evictAll(boolean backup)
Evicts all keys except locked ones.
|
void |
evictEntries(Data excludedKey)
Evicts entries from this record-store.
|
void |
evictExpiredEntries(int percentage,
boolean backup)
Do expiration operations.
|
boolean |
extendLock(Data key,
String caller,
long threadId,
long ttl) |
MapEntriesWithCursor |
fetchEntries(int tableIndex,
int size)
Fetches specified number of entries from provided tableIndex.
|
MapKeysWithCursor |
fetchKeys(int tableIndex,
int size)
Fetches specified number of keys from provided tableIndex.
|
boolean |
forceUnlock(Data dataKey) |
Object |
get(Data dataKey,
boolean backup)
Gets record from
RecordStore . |
MapEntries |
getAll(Set<Data> keySet) |
int |
getLockedEntryCount() |
String |
getLockOwnerInfo(Data key) |
MapContainer |
getMapContainer() |
MapDataStore<Data,Object> |
getMapDataStore() |
String |
getName() |
long |
getOwnedEntryCost() |
int |
getPartitionId() |
R |
getRecord(Data key) |
R |
getRecordOrNull(Data key)
Returns live record or null if record is already expired.
|
Storage |
getStorage() |
void |
init()
Initialize the recordStore after creation
|
boolean |
isEmpty() |
boolean |
isExpirable() |
boolean |
isExpired(R record,
long now,
boolean backup)
Checks whether a record is expired or not.
|
boolean |
isKeyLoadFinished() |
boolean |
isLoaded() |
boolean |
isLocked(Data key) |
boolean |
isTransactionallyLocked(Data key) |
Iterator<Record> |
iterator()
Iterates over record store entries.
|
Iterator<Record> |
iterator(long now,
boolean backup)
Iterates over record store entries by respecting expiration.
|
Set<Data> |
keySet() |
void |
loadAll(boolean replaceExistingValues)
Loads all keys and values
|
void |
loadAllFromStore(List<Data> keys,
boolean replaceExistingValues)
Loads all given keys from defined map store.
|
Iterator<Record> |
loadAwareIterator(long now,
boolean backup)
Iterates over record store entries but first waits map store to load.
|
Record |
loadRecordOrNull(Data key,
boolean backup) |
void |
maybeDoInitialLoad()
Performs initial loading from a MapLoader if it has not been done before
|
boolean |
merge(Data dataKey,
EntryView mergingEntryView,
MapMergePolicy mergePolicy) |
Object |
put(Data dataKey,
Object dataValue,
long ttl) |
R |
putBackup(Data key,
Object value) |
R |
putBackup(Data key,
Object value,
long ttl,
boolean putTransient) |
Object |
putFromLoad(Data key,
Object value)
Puts key-value pair to map which is the result of a load from map store operation.
|
Object |
putFromLoad(Data key,
Object value,
long ttl)
Puts key-value pair to map which is the result of a load from map store operation.
|
Object |
putFromLoadBackup(Data key,
Object value)
Puts key-value pair to map which is the result of a load from map store operation on backup.
|
Object |
putIfAbsent(Data dataKey,
Object value,
long ttl) |
void |
putRecord(Data key,
R record)
Puts a data key and a record value to record-store.
|
void |
putTransient(Data dataKey,
Object value,
long ttl) |
Data |
readBackupData(Data key)
Called when
MapConfig.isReadBackupData() is true from
MapProxySupport.getInternal(com.hazelcast.nio.serialization.Data)
Returns corresponding value for key as Data . |
Object |
remove(Data dataKey) |
boolean |
remove(Data dataKey,
Object testValue) |
void |
removeBackup(Data dataKey)
Similar to
remove(com.hazelcast.nio.serialization.Data)
except removeBackup doesn't touch mapstore since it does not return previous value. |
Object |
replace(Data dataKey,
Object update) |
boolean |
replace(Data dataKey,
Object expect,
Object update)
Sets the value to the given updated value
if
RecordFactory.isEquals(java.lang.Object, java.lang.Object) comparison
of current value and expected value is true . |
void |
reset()
Resets the record store to it's initial state.
|
boolean |
set(Data dataKey,
Object value,
long ttl)
Returns
true if key doesn't exist previously, otherwise returns false . |
void |
setPreMigrationLoadedStatus(boolean loaded)
Informs this recordStore about the loading status of the recordStore that this store is migrated from.
|
boolean |
shouldEvict()
Returns
true if eviction is allowed on this record-store, otherwise false |
int |
size() |
long |
softFlush() |
void |
startLoading()
Starts mapLoader
|
boolean |
txnLock(Data key,
String caller,
long threadId,
long referenceId,
long ttl,
boolean blockReads) |
boolean |
unlock(Data key,
String caller,
long threadId,
long referenceId) |
void |
updateLoadStatus(boolean lastBatch,
Throwable exception) |
decreaseHits, getHits, getLastAccessTime, getLastUpdateTime, increaseHits, increaseHits, setLastAccessTime, setLastUpdateTime
static final long DEFAULT_TTL
String getName()
R putBackup(Data key, Object value, long ttl, boolean putTransient)
key
- the key to be processed.value
- the value to be processed.ttl
- milliseconds. Check out MapProxySupport.putInternal(com.hazelcast.nio.serialization.Data, com.hazelcast.nio.serialization.Data, long, java.util.concurrent.TimeUnit)
putTransient
- true
if putting transient entry, otherwise false
boolean set(Data dataKey, Object value, long ttl)
true
if key doesn't exist previously, otherwise returns false
.IMap.set(Object, Object)
boolean delete(Data dataKey)
void removeBackup(Data dataKey)
remove(com.hazelcast.nio.serialization.Data)
except removeBackup doesn't touch mapstore since it does not return previous value.Object get(Data dataKey, boolean backup)
RecordStore
.
Loads missing keys from map store.dataKey
- key.backup
- true
if a backup partition, otherwise false
.RecordStore
Data readBackupData(Data key)
MapConfig.isReadBackupData()
is true
from
MapProxySupport.getInternal(com.hazelcast.nio.serialization.Data)
Returns corresponding value for key as Data
.
This adds an extra serialization step. For the reason of this behaviour please see issue 1292 on github.key
- key to be accessedData
independent of InMemoryFormat
MapEntries getAll(Set<Data> keySet)
boolean containsKey(Data dataKey)
int getLockedEntryCount()
boolean replace(Data dataKey, Object expect, Object update)
RecordFactory.isEquals(java.lang.Object, java.lang.Object)
comparison
of current value and expected value is true
.dataKey
- key which's value is requested to be replaced.expect
- the expected valueupdate
- the new valuetrue
if successful. False return indicates that
the actual value was not equal to the expected value.Object putFromLoad(Data key, Object value)
key
- key to put.value
- to put.PutFromLoadAllOperation
Object putFromLoadBackup(Data key, Object value)
key
- key to put.value
- to put.PutFromLoadAllBackupOperation
Object putFromLoad(Data key, Object value, long ttl)
key
- key to put.value
- to put.ttl
- time to live seconds.PutFromLoadAllOperation
boolean merge(Data dataKey, EntryView mergingEntryView, MapMergePolicy mergePolicy)
void putRecord(Data key, R record)
key
- the data key to put record store.record
- the value for record store.MapReplicationOperation
Iterator<Record> iterator()
Iterator<Record> iterator(long now, boolean backup)
MapKeysWithCursor fetchKeys(int tableIndex, int size)
MapKeysWithCursor
which is a holder for keys and next index to read from.MapEntriesWithCursor fetchEntries(int tableIndex, int size)
MapEntriesWithCursor
which is a holder for entries and next index to read from.Iterator<Record> loadAwareIterator(long now, boolean backup)
IMap.keySet(com.hazelcast.query.Predicate)
,
this method can be used to return a read-only iterator.now
- current time in millisbackup
- true
if a backup partition, otherwise false
.int size()
boolean txnLock(Data key, String caller, long threadId, long referenceId, long ttl, boolean blockReads)
boolean isLocked(Data key)
boolean isTransactionallyLocked(Data key)
boolean containsValue(Object testValue)
int evictAll(boolean backup)
backup
- true
if a backup partition, otherwise false
.MapContainer getMapContainer()
long softFlush()
MapDataStore.softFlush()
void clearPartition(boolean onShutdown)
onShutdown
- true if close
is called during MapService shutdown,
false otherwise.void reset()
boolean forceUnlock(Data dataKey)
long getOwnedEntryCost()
boolean isLoaded()
void checkIfLoaded() throws RetryableHazelcastException
RetryableHazelcastException
int clear()
boolean isEmpty()
void evictExpiredEntries(int percentage, boolean backup)
percentage
- of max expirables according to the record store size.backup
- true
if a backup partition, otherwise false
.boolean isExpirable()
true
if record store has at least one candidate entry
for expiration else return false
.boolean isExpired(R record, long now, boolean backup)
record
- the record from record-store.now
- current time in millisbackup
- true
if a backup partition, otherwise false
.true
if the record is expired, false
otherwise.void doPostEvictionOperations(Record record, boolean backup)
record
- record to processbackup
- true
if a backup partition, otherwise false
.void loadAllFromStore(List<Data> keys, boolean replaceExistingValues)
keys
- keys to be loaded.void updateLoadStatus(boolean lastBatch, Throwable exception)
MapDataStore<Data,Object> getMapDataStore()
int getPartitionId()
R getRecordOrNull(Data key)
key
- key to be accessedget(com.hazelcast.nio.serialization.Data, boolean)
void evictEntries(Data excludedKey)
excludedKey
- this key has lowest priority to be selected for evictionboolean shouldEvict()
true
if eviction is allowed on this record-store, otherwise false
true
if eviction is allowed on this record-store, otherwise false
void loadAll(boolean replaceExistingValues)
replaceExistingValues
- true
if need to replace existing values otherwise false
void maybeDoInitialLoad()
Storage createStorage(RecordFactory<R> recordFactory, InMemoryFormat memoryFormat)
void disposeDeferredBlocks()
void destroy()
Storage getStorage()
void startLoading()
void setPreMigrationLoadedStatus(boolean loaded)
This method should be deleted when the map's lifecycle has been cleaned-up. Currently it's impossible to pass additional state when the record store is created, thus this this state has to be passed in post-creation setters which is cumbersome and error-prone.
void init()
boolean isKeyLoadFinished()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.