use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.
the class BytesMapPartitionImpl method remove.
@Override
public void remove(Set<ByteArray> keys) {
synchronized (map) {
for (ByteArray key : keys) {
map.remove(key);
}
mapBackupExecutor.remove(mapSetting, keys);
mapPersistExecutor.delete(mapSetting, keys);
}
for (ByteArray key : keys) {
lockProvider.removeLock(key);
}
mapEviction.removeKeys(keys);
}
use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.
the class BytesMapPartitionImpl method get.
@Override
public Map<ByteArray, byte[]> get(Set<ByteArray> keys) {
Map<ByteArray, byte[]> answer = new HashMap<>();
Set<ByteArray> unloadKeys = new HashSet<>();
synchronized (map) {
for (ByteArray key : keys) {
byte[] value = map.get(key);
if (value != null) {
answer.put(key, value);
} else {
unloadKeys.add(key);
}
}
}
if (unloadKeys.size() > 0) {
Map<ByteArray, byte[]> unloadItems = mapPersistExecutor.load(mapSetting, keys);
synchronized (map) {
for (ByteArray key : unloadItems.keySet()) {
byte[] value = map.get(key);
if (value == null) {
value = unloadItems.get(key);
map.put(key, value);
}
answer.put(key, value);
}
}
}
mapEviction.updateKeysTime(answer.keySet());
return answer;
}
use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.
the class SimpleBytesMapPersistExecutor method delete.
@Override
public void delete(MapSetting mapSetting, ByteArray key) {
BytesMapPersist mapPersist = getMapPersist(mapSetting);
if (mapPersist != null) {
PersistDeleteOneAction action = new PersistDeleteOneAction(key);
addPersistActionToQueue(mapSetting, action);
}
}
use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.
the class EntityBytesMapPersist method delete.
@Override
public void delete(Set<ByteArray> keys) {
Set keyEntities = new HashSet<>();
for (ByteArray key : keys) {
Object keyEntity = entityCodec.deserialize(key.getBytes(), keyType);
keyEntities.add(keyEntity);
}
entityMapPersist.delete(keyEntities);
}
use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.
the class BytesMapPersist method load.
default Map<ByteArray, byte[]> load(Set<ByteArray> keys) {
Map<ByteArray, byte[]> keyValues = new HashMap<>();
for (ByteArray key : keys) {
byte[] value = load(key);
keyValues.put(key, value);
}
return keyValues;
}
Aggregations