K
- the key type to be put in this storage.R
- the value type to be put in this storage.public interface Storage<K,R>
RecordStore
.
Includes basic storage operations.Modifier and Type | Method and Description |
---|---|
void |
clear(boolean isDuringShutdown) |
boolean |
containsKey(K key) |
void |
destroy(boolean isDuringShutdown) |
void |
disposeDeferredBlocks() |
MapEntriesWithCursor |
fetchEntries(int tableIndex,
int size,
SerializationService serializationService)
Fetch minimally
size items from the tableIndex position. |
MapKeysWithCursor |
fetchKeys(int tableIndex,
int size)
Fetch minimally
size keys from the tableIndex position. |
R |
get(K key) |
EntryCostEstimator |
getEntryCostEstimator() |
R |
getIfSameKey(K key)
Gives the same result as
get(Object) , but with the additional constraint
that the supplied key must not just be equal to, but be exactly the same key blob (at the
same memory address) as the one stored. |
Iterable<LazyEntryViewFromRecord> |
getRandomSamples(int sampleCount)
Used for sampling based eviction, returns sampled entries.
|
boolean |
isEmpty() |
Iterator<R> |
mutationTolerantIterator()
Returned iterator from this method doesn't throw
ConcurrentModificationException to fail fast. |
void |
put(K key,
R record) |
void |
removeRecord(R record) |
void |
setEntryCostEstimator(EntryCostEstimator entryCostEstimator) |
int |
size() |
void |
updateRecordValue(K key,
R record,
Object value) |
Collection<R> |
values() |
R getIfSameKey(K key)
get(Object)
, but with the additional constraint
that the supplied key must not just be equal to, but be exactly the same key blob (at the
same memory address) as the one stored. The implementation of this method is only needed
for the HD memory-based implementations.void removeRecord(R record)
boolean containsKey(K key)
Collection<R> values()
Iterator<R> mutationTolerantIterator()
ConcurrentModificationException
to fail fast.
Because fail fast may not be the desired behaviour always. For example if you are caching an iterator as in
AbstractEvictableRecordStore.expirationIterator
and you know that in next rounds you will
eventually visit all entries, you don't need fail fast behaviour.
Note that returned iterator is not thread-safe !!!int size()
boolean isEmpty()
void clear(boolean isDuringShutdown)
void destroy(boolean isDuringShutdown)
EntryCostEstimator getEntryCostEstimator()
void setEntryCostEstimator(EntryCostEstimator entryCostEstimator)
void disposeDeferredBlocks()
Iterable<LazyEntryViewFromRecord> getRandomSamples(int sampleCount)
sampleCount
- sample count.MapKeysWithCursor fetchKeys(int tableIndex, int size)
size
keys from the tableIndex
position. The key is fetched on-heap.
NOTE: The implementation is free to return more than size
items. This can happen if we cannot easily resume
from the last returned item by receiving the tableIndex
of the last item. The index can represent a bucket
with multiple items and in this case the returned object will contain all items in that bucket, regardless if we exceed
the requested size
.
tableIndex
- the index (position) from which to resumesize
- the minimal count of returned itemsMapEntriesWithCursor fetchEntries(int tableIndex, int size, SerializationService serializationService)
size
items from the tableIndex
position. Both the key and value are fetched on-heap.
NOTE: The implementation is free to return more than size
items. This can happen if we cannot easily resume
from the last returned item by receiving the tableIndex
of the last item. The index can represent a bucket
with multiple items and in this case the returned object will contain all items in that bucket, regardless if we exceed
the requested size
.
tableIndex
- the index (position) from which to resumesize
- the minimal count of returned itemsCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.