use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class TxnSetOperation method getBackupOperation.
public Operation getBackupOperation() {
final Record record = recordStore.getRecord(dataKey);
final RecordInfo replicationInfo = record != null ? Records.buildRecordInfo(record) : null;
return new PutBackupOperation(name, dataKey, dataValue, replicationInfo, true, false);
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class TxnSetOperation method run.
@Override
public void run() {
recordStore.unlock(dataKey, ownerUuid, threadId, getCallId());
Record record = recordStore.getRecordOrNull(dataKey);
if (record == null || version == record.getVersion()) {
EventService eventService = getNodeEngine().getEventService();
if (eventService.hasEventRegistration(MapService.SERVICE_NAME, getName())) {
dataOldValue = record == null ? null : mapServiceContext.toData(record.getValue());
}
eventType = record == null ? EntryEventType.ADDED : EntryEventType.UPDATED;
recordStore.set(dataKey, dataValue, ttl);
shouldBackup = true;
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method delete.
@Override
public boolean delete(Data key) {
checkIfLoaded();
final long now = getNow();
final Record record = getRecordOrNull(key, now, false);
if (record == null) {
mapDataStore.remove(key, now);
} else {
return removeRecord(key, record, now) != null;
}
return false;
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method readBackupData.
@Override
public Data readBackupData(Data key) {
final long now = getNow();
final Record record = getRecord(key);
if (record == null) {
return null;
}
// expiration has delay on backups, but reading backup data should not be affected by this delay.
// this is the reason why we are passing `false` to isExpired() method.
final boolean expired = isExpired(record, now, false);
if (expired) {
return null;
}
final MapServiceContext mapServiceContext = this.mapServiceContext;
final Object value = record.getValue();
mapServiceContext.interceptAfterGet(name, value);
// this serialization step is needed not to expose the object, see issue 1292
return mapServiceContext.toData(value);
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method loadRecordOrNull.
@Override
public Record loadRecordOrNull(Data key, boolean backup) {
Record record = null;
final Object value = mapDataStore.load(key);
if (value != null) {
record = createRecord(value, DEFAULT_TTL, getNow());
storage.put(key, record);
if (!backup) {
saveIndex(record, null);
}
evictEntries(key);
}
// otherwise query-caches cannot see loaded entries
if (!backup && record != null && hasQueryCache()) {
addEventToQueryCache(record);
}
return record;
}
Aggregations