Search in sources :

Example 1 with KeyValueStorage

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());
    };
}
Also used : KeyValueStorage(org.apache.ignite.internal.metastorage.server.KeyValueStorage) RocksDbKeyValueStorage(org.apache.ignite.internal.metastorage.server.persistence.RocksDbKeyValueStorage) ByteArray(org.apache.ignite.lang.ByteArray)

Aggregations

KeyValueStorage (org.apache.ignite.internal.metastorage.server.KeyValueStorage)1 RocksDbKeyValueStorage (org.apache.ignite.internal.metastorage.server.persistence.RocksDbKeyValueStorage)1 ByteArray (org.apache.ignite.lang.ByteArray)1