Search in sources :

Example 1 with KVMutation

use of com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.KVMutation in project titan by thinkaurelius.

the class BerkeleyJEStoreManager method mutateMany.

@Override
public void mutateMany(Map<String, KVMutation> mutations, StoreTransaction txh) throws BackendException {
    for (Map.Entry<String, KVMutation> muts : mutations.entrySet()) {
        BerkeleyJEKeyValueStore store = openDatabase(muts.getKey());
        KVMutation mut = muts.getValue();
        if (!mut.hasAdditions() && !mut.hasDeletions()) {
            log.debug("Empty mutation set for {}, doing nothing", muts.getKey());
        } else {
            log.debug("Mutating {}", muts.getKey());
        }
        if (mut.hasAdditions()) {
            for (KeyValueEntry entry : mut.getAdditions()) {
                store.insert(entry.getKey(), entry.getValue(), txh);
                log.trace("Insertion on {}: {}", muts.getKey(), entry);
            }
        }
        if (mut.hasDeletions()) {
            for (StaticBuffer del : mut.getDeletions()) {
                store.delete(del, txh);
                log.trace("Deletion on {}: {}", muts.getKey(), del);
            }
        }
    }
}
Also used : KVMutation(com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.KVMutation) HashMap(java.util.HashMap) Map(java.util.Map) KeyValueEntry(com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.KeyValueEntry)

Aggregations

KVMutation (com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.KVMutation)1 KeyValueEntry (com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.KeyValueEntry)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1