Examples of CounterColumn


Examples of org.apache.cassandra.db.CounterColumn

        File tempSS = tempSSTableFile("Keyspace1", "Counter1");
        ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Counter1");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);

        // Add rowA
        cfamily.addColumn(null, new CounterColumn(ByteBufferUtil.bytes("colA"), 42, System.currentTimeMillis()));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();

        SSTableReader reader = writer.closeAndOpenReader();
View Full Code Here

Examples of org.apache.cassandra.db.CounterColumn

        File tempSS = tempSSTableFile("Keyspace1", "Counter1");
        ColumnFamily cfamily = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Counter1");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);

        // Add rowA
        cfamily.addColumn(new CounterColumn(ByteBufferUtil.bytes("colA"), 42, System.currentTimeMillis()));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();

        SSTableReader reader = writer.closeAndOpenReader();
View Full Code Here

Examples of org.apache.cassandra.db.CounterColumn

            {
                cfamily.addColumn(null, new ExpiringColumn(col.getName(), col.getValue(), col.timestamp, col.ttl, col.localExpirationTime));
            }
            else if (col.isCounter())
            {
                cfamily.addColumn(null, new CounterColumn(col.getName(), col.getValue(), col.timestamp, col.timestampOfLastDelete));
            }
            else if (col.isDeleted())
            {
                cfamily.addTombstone(path, col.getValue(), col.timestamp);
            }
View Full Code Here

Examples of org.apache.cassandra.thrift.CounterColumn

        ByteBuffer name = colser.toByteBuffer(colName);
        try
        {
            if (isCounter)
            {
                new Counter(client, wConsistecy, cfName).add(rKey, Lists.newArrayList(new CounterColumn(name, (Long) value)));
            }
            else
            {
                ByteBuffer val = valser.toByteBuffer(value);
                new Writer(client, wConsistecy, cfName).insert(rKey, name, val);
View Full Code Here

Examples of org.apache.cassandra.thrift.CounterColumn

                Counter counter = new Counter(client, wConsistecy, cfName);
                List<CounterColumn> columns = Lists.newArrayList();
                for (Map.Entry<?, ?> entity : nv.entrySet())
                {
                    ByteBuffer name = colser.toByteBuffer(entity.getKey());
                    columns.add(new CounterColumn(name, (Long) entity.getValue()));
                }
                counter.add(rKey, columns);
            }
            else
            {
View Full Code Here

Examples of org.apache.cassandra.thrift.CounterColumn

                Object linkValue = rh.getRelationValue();

                if (linkName != null && linkValue != null) {
                    if (metaModel.getEmbeddables(metadata.getEntityClazz()).isEmpty()) {
                        if (metadata.isCounterColumnType()) {
                            CounterColumn col = populateCounterFkey(linkName, linkValue);
                            tf.addCounterColumn(col);
                        } else {
                            Column col = populateFkey(linkName, linkValue, timestamp);
                            tf.addColumn(col);
                        }

                    } else {
                        if (metadata.isCounterColumnType()) {
                            CounterSuperColumn counterSuperColumn = new CounterSuperColumn();
                            counterSuperColumn.setName(linkName.getBytes());
                            CounterColumn column = populateCounterFkey(linkName, linkValue);
                            counterSuperColumn.addToColumns(column);
                            tf.addCounterSuperColumn(counterSuperColumn);
                        } else {
                            SuperColumn superColumn = new SuperColumn();
                            superColumn.setName(linkName.getBytes());
View Full Code Here

Examples of org.apache.cassandra.thrift.CounterColumn

     * @param rlValue
     *            the rl value
     * @return the counter column
     */
    private CounterColumn populateCounterFkey(String rlName, Object rlValue) {
        CounterColumn counterCol = new CounterColumn();
        counterCol.setName(PropertyAccessorFactory.STRING.toBytes(rlName));
        counterCol.setValue((Long) rlValue);
        return counterCol;
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.CounterColumn

                    log.warn("Counter value not found for {}, resetting it to zero.", descriptor.getPkColumnName());
                    latestCount = 0;
                }
                ColumnParent columnParent = new ColumnParent(descriptor.getTable());

                CounterColumn counterColumn =
                    new CounterColumn(ByteBuffer.wrap(descriptor.getValueColumnName().getBytes()), 1);

                conn.add(ByteBuffer.wrap(descriptor.getPkColumnValue().getBytes()), columnParent, counterColumn,
                    getConsistencyLevel());
            }
            if (latestCount == 0) {
View Full Code Here

Examples of org.apache.cassandra.thrift.CounterColumn

    {
        if (value != null)
        {
            if (m.isCounterColumnType())
            {
                CounterColumn counterColumn = prepareCounterColumn((String) value, name);
                tr.addCounterColumn(counterColumn);
            }
            else
            {
                Column column = prepareColumn((byte[]) value, name, timestamp, ttl);
View Full Code Here

Examples of org.apache.cassandra.thrift.CounterColumn

        {
            if (m.isCounterColumnType())
            {
                CounterSuperColumn counterSuper = new CounterSuperColumn();
                counterSuper.setName(name);
                CounterColumn counterColumn = prepareCounterColumn((String) value, name);
                List<CounterColumn> subCounterColumn = new ArrayList<CounterColumn>();
                subCounterColumn.add(counterColumn);
                counterSuper.setColumns(subCounterColumn);
                tr.addCounterSuperColumn(counterSuper);
            }
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.