Search in sources :

Example 11 with ByteArray

use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.

the class SimpleBytesMapPersistExecutor method persist.

@Override
public void persist(MapSetting mapSetting, ByteArray key, byte[] value) {
    BytesMapPersist mapPersist = getMapPersist(mapSetting);
    if (mapPersist != null) {
        PersistSaveOneAction action = new PersistSaveOneAction(key, value);
        addPersistActionToQueue(mapSetting, action);
    }
}
Also used : BytesMapPersist(com.tvd12.calabash.persist.BytesMapPersist)

Example 12 with ByteArray

use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.

the class EntityBytesMapPersist method persist.

@Override
public void persist(Map<ByteArray, byte[]> m) {
    Map entities = new HashMap<>();
    for (ByteArray key : m.keySet()) {
        byte[] value = m.get(key);
        Object keyEntity = entityCodec.deserialize(key.getBytes(), keyType);
        Object valueEntity = entityCodec.deserialize(value, valueType);
        entities.put(keyEntity, valueEntity);
    }
    entityMapPersist.persist(entities);
}
Also used : HashMap(java.util.HashMap) ByteArray(com.tvd12.calabash.core.util.ByteArray) Map(java.util.Map) HashMap(java.util.HashMap)

Example 13 with ByteArray

use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.

the class EntityBytesMapPersist method serializeEntities.

protected Map<ByteArray, byte[]> serializeEntities(Map entities) {
    Map<ByteArray, byte[]> answer = new HashMap<>();
    for (Object keyEntity : entities.keySet()) {
        Object valueEntity = entities.get(keyEntity);
        byte[] key = entityCodec.serialize(keyEntity);
        byte[] value = entityCodec.serialize(valueEntity);
        answer.put(new ByteArray(key), value);
    }
    return answer;
}
Also used : HashMap(java.util.HashMap) ByteArray(com.tvd12.calabash.core.util.ByteArray)

Example 14 with ByteArray

use of com.tvd12.calabash.core.util.ByteArray in project calabash by youngmonkeys.

the class BytesMapPersist method persist.

default void persist(Map<ByteArray, byte[]> m) {
    for (ByteArray key : m.keySet()) {
        byte[] value = m.get(key);
        persist(key, value);
    }
}
Also used : ByteArray(com.tvd12.calabash.core.util.ByteArray)

Aggregations

ByteArray (com.tvd12.calabash.core.util.ByteArray)10 BytesMapPersist (com.tvd12.calabash.persist.BytesMapPersist)4 BytesMap (com.tvd12.calabash.core.BytesMap)3 HashMap (java.util.HashMap)3 SimpleSettings (com.tvd12.calabash.server.core.setting.SimpleSettings)2 Calabash (com.tvd12.calabash.Calabash)1 BytesMapPersistFactory (com.tvd12.calabash.persist.factory.BytesMapPersistFactory)1 EntityBytesMapPersistFactory (com.tvd12.calabash.persist.factory.EntityBytesMapPersistFactory)1 SimpleEntityMapPersistFactory (com.tvd12.calabash.persist.factory.SimpleEntityMapPersistFactory)1 MapPersistManager (com.tvd12.calabash.persist.manager.MapPersistManager)1 SimpleMapPersistManager (com.tvd12.calabash.persist.manager.SimpleMapPersistManager)1 SimpleMapPersistSetting (com.tvd12.calabash.persist.setting.SimpleMapPersistSetting)1 BytesMapBackupExecutor (com.tvd12.calabash.server.core.executor.BytesMapBackupExecutor)1 BytesMapPersistExecutor (com.tvd12.calabash.server.core.executor.BytesMapPersistExecutor)1 SimpleBytesMapBackupExecutor (com.tvd12.calabash.server.core.executor.SimpleBytesMapBackupExecutor)1 SimpleBytesMapPersistExecutor (com.tvd12.calabash.server.core.executor.SimpleBytesMapPersistExecutor)1 Settings (com.tvd12.calabash.server.core.setting.Settings)1 SimpleMapSetting (com.tvd12.calabash.server.core.setting.SimpleMapSetting)1 EzyBeanContext (com.tvd12.ezyfox.bean.EzyBeanContext)1 Rpc (com.tvd12.quick.rpc.server.annotation.Rpc)1