com.hazelcast.map.impl
Interface RecordStore

All Known Implementing Classes:
DefaultRecordStore

public interface RecordStore

Defines a record-store.


Method Summary
 boolean canAcquireLock(Data key, String caller, long threadId)
           
 void checkIfLoaded()
           
 int clear()
           
 void clearPartition()
           
 boolean containsKey(Data dataKey)
           
 boolean containsValue(Object testValue)
           
 boolean delete(Data dataKey)
           
 Set<Map.Entry<Data,Data>> entrySetData()
           
 Object evict(Data key, boolean backup)
           
 int evictAll(boolean backup)
          Evicts all keys except locked ones.
 void evictEntries(long now, boolean backup)
           
 void evictExpiredEntries(int percentage, boolean backup)
          Do expiration operations.
 boolean extendLock(Data key, String caller, long threadId, long ttl)
           
 void flush()
           
 boolean forceUnlock(Data dataKey)
           
 Object get(Data dataKey, boolean backup)
          Gets record from RecordStore.
 MapEntrySet getAll(Set<Data> keySet)
           
 long getHeapCost()
           
 String getLockOwnerInfo(Data key)
           
 MapContainer getMapContainer()
           
 MapDataStore<Data,Object> getMapDataStore()
           
 Map.Entry<Data,Object> getMapEntry(Data dataKey, long now)
           
 String getName()
           
 int getPartitionId()
           
 Record getRecord(Data key)
           
 Map<Data,Record> getRecordMap()
          Returns records map.
 Record getRecordOrNull(Data key)
          Returns live record or null if record is already expired.
 boolean isEmpty()
           
 boolean isExpirable()
           
 boolean isLoaded()
           
 boolean isLocked(Data key)
           
 boolean isTransactionallyLocked(Data key)
           
 Iterator<Record> iterator()
          Iterates over record store values.
 Iterator<Record> iterator(long now, boolean backup)
          Iterates over record store values by respecting expiration.
 Set<Data> keySet()
           
 void loadAllFromStore(List<Data> keys, boolean replaceExistingValues)
          Loads all keys from defined map store.
 Iterator<Record> loadAwareIterator(long now, boolean backup)
          Iterates over record store values but first waits map store to load.
 boolean merge(Data dataKey, EntryView mergingEntryView, MapMergePolicy mergePolicy)
           
 Object put(Data dataKey, Object dataValue, long ttl)
           
 void put(Map.Entry<Data,Object> entry)
           
 Record putBackup(Data key, Object value)
           
 Record putBackup(Data key, Object value, long ttl)
           
 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 putIfAbsent(Data dataKey, Object value, long ttl)
           
 void putRecord(Data key, Record 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()
           
 boolean set(Data dataKey, Object value, long ttl)
           
 void setLoaded(boolean loaded)
           
 int size()
           
 boolean tryPut(Data dataKey, Object value, long ttl)
           
 boolean txnLock(Data key, String caller, long threadId, long ttl)
           
 boolean unlock(Data key, String caller, long threadId)
           
 Collection<Data> valuesData()
           
 

Method Detail

getName

String getName()

put

Object put(Data dataKey,
           Object dataValue,
           long ttl)

put

void put(Map.Entry<Data,Object> entry)

putIfAbsent

Object putIfAbsent(Data dataKey,
                   Object value,
                   long ttl)

putBackup

Record putBackup(Data key,
                 Object value)

putBackup

Record putBackup(Data key,
                 Object value,
                 long ttl)

tryPut

boolean tryPut(Data dataKey,
               Object value,
               long ttl)

set

boolean set(Data dataKey,
            Object value,
            long ttl)

remove

Object remove(Data dataKey)

delete

boolean delete(Data dataKey)

remove

boolean remove(Data dataKey,
               Object testValue)

removeBackup

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.


get

Object get(Data dataKey,
           boolean backup)
Gets record from RecordStore. Loads missing keys from map store.

Parameters:
dataKey - key.
backup - true if a backup partition, otherwise false.
Returns:
value of an entry in RecordStore

readBackupData

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. This adds an extra serialization step. For the reason of this behaviour please see issue 1292 on github.

Parameters:
key - key to be accessed
Returns:
value as Data independent of InMemoryFormat

getAll

MapEntrySet getAll(Set<Data> keySet)

containsKey

boolean containsKey(Data dataKey)

replace

Object replace(Data dataKey,
               Object update)

replace

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.

Parameters:
dataKey - key which's value is requested to be replaced.
expect - the expected value
update - the new value
Returns:
true if successful. False return indicates that the actual value was not equal to the expected value.

putTransient

void putTransient(Data dataKey,
                  Object value,
                  long ttl)

putFromLoad

Object putFromLoad(Data key,
                   Object value)
Puts key-value pair to map which is the result of a load from map store operation.

Parameters:
key - key to put.
value - to put.
Returns:
the previous value associated with key, or null if there was no mapping for key.
See Also:
PutFromLoadAllOperation

putFromLoad

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.

Parameters:
key - key to put.
value - to put.
ttl - time to live seconds.
Returns:
the previous value associated with key, or null if there was no mapping for key.
See Also:
PutAllOperation

merge

boolean merge(Data dataKey,
              EntryView mergingEntryView,
              MapMergePolicy mergePolicy)

getRecord

Record getRecord(Data key)

putRecord

void putRecord(Data key,
               Record record)
Puts a data key and a record value to record-store. Used in replication operations.

Parameters:
key - the data key to put record store.
record - the value for record store.
See Also:
MapReplicationOperation

iterator

Iterator<Record> iterator()
Iterates over record store values.

Returns:
read only iterator for map values.

iterator

Iterator<Record> iterator(long now,
                          boolean backup)
Iterates over record store values by respecting expiration.

Returns:
read only iterator for map values.

loadAwareIterator

Iterator<Record> loadAwareIterator(long now,
                                   boolean backup)
Iterates over record store values but first waits map store to load. If an operation needs to wait a data source load like query operations IMap.keySet(com.hazelcast.query.Predicate), this method can be used to return a read-only iterator.

Parameters:
now - current time in millis
backup - true if a backup partition, otherwise false.
Returns:
read only iterator for map values.

getRecordMap

Map<Data,Record> getRecordMap()
Returns records map.

See Also:
RecordStoreLoader

keySet

Set<Data> keySet()

size

int size()

txnLock

boolean txnLock(Data key,
                String caller,
                long threadId,
                long ttl)

extendLock

boolean extendLock(Data key,
                   String caller,
                   long threadId,
                   long ttl)

unlock

boolean unlock(Data key,
               String caller,
               long threadId)

isLocked

boolean isLocked(Data key)

isTransactionallyLocked

boolean isTransactionallyLocked(Data key)

canAcquireLock

boolean canAcquireLock(Data key,
                       String caller,
                       long threadId)

getLockOwnerInfo

String getLockOwnerInfo(Data key)

containsValue

boolean containsValue(Object testValue)

evict

Object evict(Data key,
             boolean backup)

evictAll

int evictAll(boolean backup)
Evicts all keys except locked ones.

Parameters:
backup - true if a backup partition, otherwise false.
Returns:
number of evicted entries.

valuesData

Collection<Data> valuesData()

getMapContainer

MapContainer getMapContainer()

entrySetData

Set<Map.Entry<Data,Data>> entrySetData()

getMapEntry

Map.Entry<Data,Object> getMapEntry(Data dataKey,
                                   long now)

flush

void flush()

clearPartition

void clearPartition()

reset

void reset()

forceUnlock

boolean forceUnlock(Data dataKey)

getHeapCost

long getHeapCost()

isLoaded

boolean isLoaded()

checkIfLoaded

void checkIfLoaded()

setLoaded

void setLoaded(boolean loaded)

clear

int clear()

isEmpty

boolean isEmpty()

evictExpiredEntries

void evictExpiredEntries(int percentage,
                         boolean backup)
Do expiration operations.

Parameters:
percentage - of max expirables according to the record store size.
backup - true if a backup partition, otherwise false.

isExpirable

boolean isExpirable()
Returns:
true if record store has at least one candidate entry for expiration else return false.

loadAllFromStore

void loadAllFromStore(List<Data> keys,
                      boolean replaceExistingValues)
Loads all keys from defined map store.

Parameters:
keys - keys to be loaded.
replaceExistingValues - true if need to replace existing values otherwise false

getMapDataStore

MapDataStore<Data,Object> getMapDataStore()

getPartitionId

int getPartitionId()

getRecordOrNull

Record getRecordOrNull(Data key)
Returns live record or null if record is already expired. Does not load missing keys from a map store.

Parameters:
key - key to be accessed
Returns:
live record or null
See Also:
get(com.hazelcast.nio.serialization.Data, boolean)

evictEntries

void evictEntries(long now,
                  boolean backup)


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.