use of org.apache.ignite.internal.storage.SearchRow in project ignite-3 by apache.
the class ConcurrentHashMapPartitionStorage method removeAll.
/**
* {@inheritDoc}
*/
@Override
public Collection<SearchRow> removeAll(List<? extends SearchRow> keys) {
var skippedRows = new ArrayList<SearchRow>(keys.size());
for (SearchRow key : keys) {
byte[] keyBytes = key.keyBytes();
byte[] removedValueBytes = map.remove(new ByteArray(keyBytes));
if (removedValueBytes == null) {
skippedRows.add(key);
}
}
return skippedRows;
}
use of org.apache.ignite.internal.storage.SearchRow in project ignite-3 by apache.
the class RocksDbPartitionStorage method removeAll.
/**
* {@inheritDoc}
*/
@Override
public Collection<SearchRow> removeAll(List<? extends SearchRow> keys) {
List<SearchRow> skippedRows = new ArrayList<>();
try (var batch = new WriteBatch();
var opts = new WriteOptions()) {
for (SearchRow key : keys) {
byte[] partitionKey = partitionKey(key);
byte[] value = data.get(partitionKey);
if (value != null) {
data.delete(batch, partitionKey);
} else {
skippedRows.add(key);
}
}
db.write(opts, batch);
} catch (RocksDBException e) {
throw new StorageException("Failed to remove data from the storage", e);
}
return skippedRows;
}
Aggregations