use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecord in project hazelcast by hazelcast.
the class EntrySetOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(name);
List<Map.Entry<Object, ReplicatedRecord>> entries = new ArrayList<>();
for (ReplicatedRecordStore store : stores) {
entries.addAll(store.entrySet(false));
}
ArrayList<Map.Entry<Data, Data>> dataEntries = new ArrayList<>(entries.size());
SerializationService serializationService = getNodeEngine().getSerializationService();
for (Map.Entry<Object, ReplicatedRecord> entry : entries) {
Data key = serializationService.toData(entry.getKey());
Data value = serializationService.toData(entry.getValue().getValue());
dataEntries.add(new AbstractMap.SimpleImmutableEntry<>(key, value));
}
response = new MapEntries(dataEntries);
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecord in project hazelcast by hazelcast.
the class GetOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, false, getPartitionId());
if (store != null) {
ReplicatedRecord record = store.getReplicatedRecord(key);
if (record != null) {
response = record.getValue();
}
}
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecord in project hazelcast by hazelcast.
the class ReplicationOperation method fetchReplicatedMapRecords.
private void fetchReplicatedMapRecords(PartitionContainer container) {
int storeCount = container.getStores().size();
data = createHashMap(storeCount);
versions = createHashMap(storeCount);
for (Map.Entry<String, ReplicatedRecordStore> entry : container.getStores().entrySet()) {
String name = entry.getKey();
ReplicatedRecordStore store = entry.getValue();
Set<RecordMigrationInfo> recordSet = createHashSet(store.size());
Iterator<ReplicatedRecord> iterator = store.recordIterator();
while (iterator.hasNext()) {
ReplicatedRecord record = iterator.next();
Data dataKey = serializationService.toData(record.getKeyInternal());
Data dataValue = serializationService.toData(record.getValueInternal());
RecordMigrationInfo migrationInfo = new RecordMigrationInfo();
migrationInfo.setKey(dataKey);
migrationInfo.setValue(dataValue);
migrationInfo.setTtl(record.getTtlMillis());
migrationInfo.setHits(record.getHits());
migrationInfo.setCreationTime(record.getCreationTime());
migrationInfo.setLastAccessTime(record.getLastAccessTime());
migrationInfo.setLastUpdateTime(record.getUpdateTime());
recordSet.add(migrationInfo);
}
data.put(name, recordSet);
versions.put(name, store.getVersion());
}
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecord in project hazelcast by hazelcast.
the class ValuesOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(name);
Collection<ReplicatedRecord> values = new ArrayList<>();
for (ReplicatedRecordStore store : stores) {
values.addAll(store.values(false));
}
Collection<Data> dataValues = new ArrayList<>(values.size());
SerializationService serializationService = getNodeEngine().getSerializationService();
for (ReplicatedRecord value : values) {
dataValues.add(serializationService.toData(value.getValue()));
}
response = new DataCollection(dataValues);
}
Aggregations