mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-392 Add entry checksums
This commit is contained in:
@@ -21,6 +21,7 @@ import net.openhft.chronicle.hash.impl.stage.entry.*;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.KeyBytesInterop;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.OwnerThreadHolder;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.ThreadLocalCopiesHolder;
|
||||
import net.openhft.chronicle.hash.impl.stage.iter.IterationKeyHashCode;
|
||||
import net.openhft.chronicle.hash.impl.stage.iter.IterationSegmentStages;
|
||||
import net.openhft.chronicle.hash.impl.stage.query.KeySearch;
|
||||
import net.openhft.chronicle.map.impl.stage.data.bytes.EntryValueBytesData;
|
||||
@@ -46,6 +47,7 @@ import net.openhft.sg.Staged;
|
||||
|
||||
KeyBytesInterop.class,
|
||||
IterationSegmentStages.class,
|
||||
IterationKeyHashCode.class,
|
||||
HashLookupPos.class,
|
||||
IterationCheckOnEachPublicOperation.class,
|
||||
AllocatedChunks.class,
|
||||
@@ -65,6 +67,8 @@ import net.openhft.sg.Staged;
|
||||
EntryValueBytesData.class,
|
||||
|
||||
WrappedValueInstanceData.class,
|
||||
|
||||
HashKeyCrc32PayloadChecksumStrategy.class,
|
||||
})
|
||||
public class MapIterationContext {
|
||||
}
|
||||
|
||||
@@ -19,10 +19,7 @@ package net.openhft.chronicle.map.impl;
|
||||
import net.openhft.chronicle.hash.impl.stage.data.bytes.EntryKeyBytesData;
|
||||
import net.openhft.chronicle.hash.impl.stage.data.bytes.InputKeyBytesData;
|
||||
import net.openhft.chronicle.hash.impl.stage.data.instance.InputKeyInstanceData;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.InputKeyHashCode;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.ReadLock;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.UpdateLock;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.WriteLock;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.*;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.KeyBytesInterop;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.OwnerThreadHolder;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.ThreadLocalCopiesHolder;
|
||||
@@ -90,6 +87,8 @@ nested = {
|
||||
AcquireHandle.class,
|
||||
DefaultReturnValue.class,
|
||||
UsingReturnValue.class,
|
||||
|
||||
HashKeyCrc32PayloadChecksumStrategy.class,
|
||||
})
|
||||
public class MapQueryContext {
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.openhft.chronicle.hash.impl.stage.entry.*;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.KeyBytesInterop;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.OwnerThreadHolder;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.ThreadLocalCopiesHolder;
|
||||
import net.openhft.chronicle.hash.impl.stage.iter.IterationKeyHashCode;
|
||||
import net.openhft.chronicle.hash.impl.stage.iter.IterationSegmentStages;
|
||||
import net.openhft.chronicle.hash.impl.stage.query.KeySearch;
|
||||
import net.openhft.chronicle.map.impl.stage.data.DummyValueZeroData;
|
||||
@@ -47,6 +48,7 @@ import net.openhft.sg.Staged;
|
||||
|
||||
KeyBytesInterop.class,
|
||||
IterationSegmentStages.class,
|
||||
IterationKeyHashCode.class,
|
||||
HashLookupPos.class,
|
||||
IterationCheckOnEachPublicOperation.class,
|
||||
AllocatedChunks.class,
|
||||
@@ -73,7 +75,9 @@ import net.openhft.sg.Staged;
|
||||
DummyValueZeroData.class,
|
||||
|
||||
ReplicatedMapAbsentDelegatingForIteration.class,
|
||||
ReplicatedMapEntryDelegating.class
|
||||
ReplicatedMapEntryDelegating.class,
|
||||
|
||||
HashKeyCrc32PayloadChecksumStrategy.class,
|
||||
})
|
||||
public class ReplicatedMapIterationContext {
|
||||
}
|
||||
|
||||
@@ -19,10 +19,7 @@ package net.openhft.chronicle.map.impl;
|
||||
import net.openhft.chronicle.hash.impl.stage.data.bytes.EntryKeyBytesData;
|
||||
import net.openhft.chronicle.hash.impl.stage.data.bytes.InputKeyBytesData;
|
||||
import net.openhft.chronicle.hash.impl.stage.data.instance.InputKeyInstanceData;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.InputKeyHashCode;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.ReadLock;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.UpdateLock;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.WriteLock;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.*;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.KeyBytesInterop;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.LogHolder;
|
||||
import net.openhft.chronicle.hash.impl.stage.hash.OwnerThreadHolder;
|
||||
@@ -109,6 +106,8 @@ nested = {
|
||||
ReplicatedInputValueBytesData.class,
|
||||
|
||||
DummyValueZeroData.class,
|
||||
|
||||
HashKeyCrc32PayloadChecksumStrategy.class,
|
||||
})
|
||||
public class ReplicatedMapQueryContext {
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public abstract class MapSegmentIteration<K, V, R> extends HashSegmentIteration<
|
||||
checkOnEachPublicOperation.checkOnEachPublicOperation();
|
||||
try {
|
||||
entry.innerDefaultReplaceValue(newValue);
|
||||
entry.checksumStrategy.computeAndStoreChecksum();
|
||||
} finally {
|
||||
s.innerWriteLock.unlock();
|
||||
}
|
||||
|
||||
+3
@@ -57,6 +57,7 @@ public abstract class ReplicatedMapSegmentIteration<K, V, R> extends MapSegmentI
|
||||
entry.innerDefaultReplaceValue(newValue);
|
||||
ru.updateChange();
|
||||
e.updatedReplicationStateOnPresentEntry();
|
||||
e.checksumStrategy.computeAndStoreChecksum();
|
||||
} finally {
|
||||
s.innerWriteLock.unlock();
|
||||
}
|
||||
@@ -118,6 +119,7 @@ public abstract class ReplicatedMapSegmentIteration<K, V, R> extends MapSegmentI
|
||||
e.updatedReplicationStateOnPresentEntry();
|
||||
e.writeEntryDeleted();
|
||||
ru.updateChange();
|
||||
e.checksumStrategy.computeAndStoreChecksum();
|
||||
s.deleted(s.deleted() + 1);
|
||||
} finally {
|
||||
s.innerWriteLock.unlock();
|
||||
@@ -144,6 +146,7 @@ public abstract class ReplicatedMapSegmentIteration<K, V, R> extends MapSegmentI
|
||||
e.writeEntryPresent();
|
||||
ru.updateChange();
|
||||
e.updatedReplicationStateOnPresentEntry();
|
||||
e.checksumStrategy.computeAndStoreChecksum();
|
||||
} finally {
|
||||
s.innerWriteLock.unlock();
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public abstract class MapAbsent<K, V> implements MapAbsentEntry<K, V> {
|
||||
s.incrementModCount();
|
||||
ks.setSearchState(PRESENT);
|
||||
q.initPresenceOfEntry(EntryPresence.PRESENT);
|
||||
e.checksumStrategy.computeAndStoreChecksum();
|
||||
} else {
|
||||
throw new IllegalStateException(
|
||||
"Entry is present in the map when doInsert() is called");
|
||||
|
||||
@@ -87,6 +87,11 @@ public abstract class MapQuery<K, V, R> extends HashQuery<K>
|
||||
|
||||
@Override
|
||||
public void doReplaceValue(Data<V> newValue) {
|
||||
doReplaceValueWithoutChecksum(newValue);
|
||||
e.checksumStrategy.computeAndStoreChecksum();
|
||||
}
|
||||
|
||||
public void doReplaceValueWithoutChecksum(Data<V> newValue) {
|
||||
putPrefix();
|
||||
if (entryPresent()) {
|
||||
e.innerDefaultReplaceValue(newValue);
|
||||
|
||||
@@ -48,6 +48,7 @@ public abstract class ReplicatedMapAbsent<K, V> extends MapAbsent<K, V> {
|
||||
e.writeEntryPresent();
|
||||
ru.updateChange();
|
||||
e.updatedReplicationStateOnAbsentEntry();
|
||||
e.checksumStrategy.computeAndStoreChecksum();
|
||||
} else {
|
||||
throw new IllegalStateException("Entry is absent in the map when doInsert() is called");
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public abstract class ReplicatedMapQuery<K, V, R> extends MapQuery<K, V, R>
|
||||
e.updatedReplicationStateOnPresentEntry();
|
||||
e.writeEntryDeleted();
|
||||
ru.updateChange();
|
||||
e.checksumStrategy.computeAndStoreChecksum();
|
||||
s.deleted(s.deleted() + 1);
|
||||
} else {
|
||||
throw new IllegalStateException("Entry is absent in the map when doRemove() is called");
|
||||
@@ -94,8 +95,9 @@ public abstract class ReplicatedMapQuery<K, V, R> extends MapQuery<K, V, R>
|
||||
|
||||
@Override
|
||||
public void doReplaceValue(Data<V> newValue) {
|
||||
super.doReplaceValue(newValue);
|
||||
doReplaceValueWithoutChecksum(newValue);
|
||||
ru.updateChange();
|
||||
e.updatedReplicationStateOnPresentEntry();
|
||||
e.checksumStrategy.computeAndStoreChecksum();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user