Search in sources :

Example 1 with KVMutation

use of org.janusgraph.diskstorage.keycolumnvalue.keyvalue.KVMutation in project janusgraph by JanusGraph.

the class BerkeleyJEStoreManager method mutateMany.

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

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 KVMutation (org.janusgraph.diskstorage.keycolumnvalue.keyvalue.KVMutation)1 KeyValueEntry (org.janusgraph.diskstorage.keycolumnvalue.keyvalue.KeyValueEntry)1