Examples of KCVMutation


Examples of com.thinkaurelius.titan.diskstorage.keycolumnvalue.KCVMutation

        return columnFamily;
    }

    @Override
    public void mutate(StaticBuffer key, List<Entry> additions, List<StaticBuffer> deletions, StoreTransaction txh) throws StorageException {
        Map<StaticBuffer, KCVMutation> mutations = ImmutableMap.of(key, new KCVMutation(additions, deletions));
        mutateMany(mutations, txh);
    }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.keycolumnvalue.KCVMutation

        for (Map.Entry<String, Map<StaticBuffer, KCVMutation>> mutEntry : mutations.entrySet()) {
            String columnFamily = mutEntry.getKey();
            for (Map.Entry<StaticBuffer, KCVMutation> titanMutation : mutEntry.getValue().entrySet()) {
                StaticBuffer key = titanMutation.getKey();
                KCVMutation mut = titanMutation.getValue();

                RowMutation rm = rowMutations.get(key);
                if (rm == null) {
                    rm = new RowMutation(keySpaceName, key.asByteBuffer());
                    rowMutations.put(key, rm);
                }

                if (mut.hasAdditions()) {
                    for (Entry e : mut.getAdditions()) {
                        // TODO are these asByteBuffer() calls too expensive?
                        QueryPath path = new QueryPath(columnFamily, null, e.getColumn().asByteBuffer());
                        rm.add(path, e.getValue().asByteBuffer(), timestamp.additionTime);
                    }
                }

                if (mut.hasDeletions()) {
                    for (StaticBuffer col : mut.getDeletions()) {
                        QueryPath path = new QueryPath(columnFamily, null, col.asByteBuffer());
                        rm.delete(path, timestamp.deletionTime);
                    }
                }
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.keycolumnvalue.KCVMutation

                if (cfmutation == null) {
                    cfmutation = new HashMap<String, List<org.apache.cassandra.thrift.Mutation>>(3); // TODO where did the magic number 3 come from?
                    batch.put(keyBB, cfmutation);
                }

                KCVMutation mutation = mutEntry.getValue();
                List<org.apache.cassandra.thrift.Mutation> thriftMutation =
                        new ArrayList<org.apache.cassandra.thrift.Mutation>(mutations.size());

                if (mutation.hasDeletions()) {
                    for (StaticBuffer buf : mutation.getDeletions()) {
                        Deletion d = new Deletion();
                        SlicePredicate sp = new SlicePredicate();
                        sp.addToColumn_names(buf.asByteBuffer());
                        d.setPredicate(sp);
                        d.setTimestamp(timestamp.deletionTime);
                        org.apache.cassandra.thrift.Mutation m = new org.apache.cassandra.thrift.Mutation();
                        m.setDeletion(d);
                        thriftMutation.add(m);
                    }
                }

                if (mutation.hasAdditions()) {
                    for (Entry ent : mutation.getAdditions()) {
                        ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
                        Column column = new Column(ent.getColumn().asByteBuffer());
                        column.setValue(ent.getValue().asByteBuffer());
                        column.setTimestamp(timestamp.additionTime);
                        cosc.setColumn(column);
View Full Code Here

Examples of com.thinkaurelius.titan.diskstorage.keycolumnvalue.KCVMutation

            Map<StaticBuffer, KCVMutation> mutations = batchentry.getValue();
            for (Map.Entry<StaticBuffer, KCVMutation> ent : mutations.entrySet()) {
                // The CLMs for additions and deletions are separated because
                // Astyanax's operation timestamp cannot be set on a per-delete
                // or per-addition basis.
                KCVMutation titanMutation = ent.getValue();

                if (titanMutation.hasDeletions()) {
                    ColumnListMutation<ByteBuffer> dels = m.withRow(columnFamily, ent.getKey().asByteBuffer());
                    dels.setTimestamp(timestamp.deletionTime);

                    for (StaticBuffer b : titanMutation.getDeletions())
                        dels.deleteColumn(b.asByteBuffer());
                }

                if (titanMutation.hasAdditions()) {
                    ColumnListMutation<ByteBuffer> upds = m.withRow(columnFamily, ent.getKey().asByteBuffer());
                    upds.setTimestamp(timestamp.additionTime);

                    for (Entry e : titanMutation.getAdditions())
                        upds.putColumn(e.getColumn().asByteBuffer(), e.getValue().asByteBuffer());
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.