use of org.apache.ignite.internal.metastorage.server.KeyValueStorage in project ignite-3 by apache.
the class ItMetaStorageServicePersistenceTest method snapshotCheckClosure.
/**
* {@inheritDoc}
*/
@Override
public BooleanSupplier snapshotCheckClosure(JraftServerImpl restarted, boolean interactedAfterSnapshot) {
KeyValueStorage storage = getListener(restarted, raftGroupId()).getStorage();
byte[] lastKey = interactedAfterSnapshot ? SECOND_KEY.bytes() : FIRST_KEY.bytes();
byte[] lastValue = interactedAfterSnapshot ? SECOND_VALUE : FIRST_VALUE;
int expectedRevision = interactedAfterSnapshot ? 4 : 3;
int expectedUpdateCounter = interactedAfterSnapshot ? 4 : 3;
EntryImpl expectedLastEntry = new EntryImpl(new ByteArray(lastKey), lastValue, expectedRevision, expectedUpdateCounter);
return () -> {
org.apache.ignite.internal.metastorage.server.Entry e = storage.get(lastKey);
return e.empty() == expectedLastEntry.empty() && e.tombstone() == expectedLastEntry.tombstone() && e.revision() == expectedLastEntry.revision() && e.updateCounter() == expectedLastEntry.revision() && Arrays.equals(e.key(), expectedLastEntry.key().bytes()) && Arrays.equals(e.value(), expectedLastEntry.value());
};
}
Aggregations