Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.CounterColumn$CounterColumnTupleSchemeFactory


    cc.setValue(value);
    return cc;
  }
 
  public static <N> CounterColumn createCounterColumn(N name, long value, Serializer<N> ns) {
    CounterColumn cc = new CounterColumn();
    cc.setName(ns.toByteBuffer(name));
    cc.setValue(value);
    return cc;
  }
View Full Code Here


        keyspace.doExecute(new KeyspaceOperationCallback<HCounterColumn<N>>() {

          @Override
          public HCounterColumn<N> doInKeyspace(KeyspaceService ks) throws HectorException {
            try {
              CounterColumn thriftCounter = ks.getCounter(keySerializer.toByteBuffer(key),
                  ThriftFactory.createColumnPath(columnFamilyName, name, columnNameSerializer));
              return new HCounterColumnImpl<N>(thriftCounter, columnNameSerializer);
            } catch (HNotFoundException e) {
              return null;
            }
View Full Code Here

  public HCounterColumnImpl(N name, Long value, Serializer<N> nameSerializer) {
    this(nameSerializer);
    notNull(name, "name is null");
    notNull(value, "value is null");
    this.counterColumn = new CounterColumn(nameSerializer.toByteBuffer(name), value);
  }
View Full Code Here

  }

  public HCounterColumnImpl(Serializer<N> nameSerializer) {
    notNull(nameSerializer, "nameSerializer is null");
    this.nameSerializer = nameSerializer;
    this.counterColumn = new CounterColumn();
  }
View Full Code Here

    @Override
    public ColumnListMutation<C> incrementCounterColumn(C columnName, long amount) {
        Preconditions.checkNotNull(columnName, "Column name cannot be null");
       
        // 1. Set up the column with all the data
        CounterColumn column = new CounterColumn();
        column.setName(columnSerializer.toByteBuffer(columnName));
        if (column.getName().length == 0) {
            throw new RuntimeException("Column name cannot be empty");
        }
        column.setValue(amount);

        // 2. Create a mutation and append to the mutation list.
        Mutation mutation = new Mutation();
        mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn().setCounter_column(column));
        mutationList.add(mutation);
View Full Code Here

                                        tracerFactory.newTracer(CassandraOperationType.COUNTER_MUTATE),
                                        getKeyspaceName()) {
                                    @Override
                                    public Void internalExecute(Client client, ConnectionContext context) throws Exception {
                                        client.add(key, ThriftConverter.getColumnParent(columnFamily, null),
                                                new CounterColumn().setValue(amount).setName(column),
                                                ThriftConverter.ToThriftConsistencyLevel(writeConsistencyLevel));
                                        return null;
                                    }

                                    @Override
View Full Code Here

    }

    @Override
    public ColumnListMutation<C> incrementCounterColumn(C columnName, long amount) {
        // 1. Set up the column with all the data
        CounterColumn column = new CounterColumn();
        column.setName(path.getSerializer().toByteBuffer(columnName));
        column.setValue(amount);

        // 2. Create the super column mutation if this is the first call
        if (superColumn == null) {
            superColumn = new CounterSuperColumn().setName(path.get(0));
View Full Code Here

                if (column.isSetSuper_column()) {
                    SuperColumn sc = column.getSuper_column();
                    return new ThriftSuperColumnImpl<C>(colSer.fromBytes(sc.getName()), sc);
                }
                else if (column.isSetCounter_column()) {
                    CounterColumn cc = column.getCounter_column();
                    return new ThriftCounterColumnImpl<C>(colSer.fromBytes(cc.getName()), cc);
                }
                else if (column.isSetCounter_super_column()) {
                    CounterSuperColumn cc = column.getCounter_super_column();
                    return new ThriftCounterSuperColumnImpl<C>(colSer.fromBytes(cc.getName()), cc);
                }
                else if (column.isSetColumn()) {
                    org.apache.cassandra.thrift.Column c = column.getColumn();
                    return new ThriftColumnImpl<C>(colSer.fromBytes(c.getName()), c);
                }
View Full Code Here

                if (column.isSetSuper_column()) {
                    SuperColumn sc = column.getSuper_column();
                    return new ThriftSuperColumnImpl<C>(colSer.fromBytes(sc.getName()), sc);
                }
                else if (column.isSetCounter_column()) {
                    CounterColumn cc = column.getCounter_column();
                    return new ThriftCounterColumnImpl<C>(colSer.fromBytes(cc.getName()), cc);
                }
                else if (column.isSetCounter_super_column()) {
                    CounterSuperColumn cc = column.getCounter_super_column();
                    return new ThriftCounterSuperColumnImpl<C>(colSer.fromBytes(cc.getName()), cc);
                }
                else if (column.isSetColumn()) {
                    org.apache.cassandra.thrift.Column c = column.getColumn();
                    return new ThriftColumnImpl<C>(colSer.fromBytes(c.getName()), c);
                }
View Full Code Here

     * @param colName               The column name.
     * @param value                 The value to increment/decrement the counter by.
     * @return                      An appropriate <code>CounterColumn</code> object
     */
    public CounterColumn newCounterColumn(Bytes colName, long value) {
        return new CounterColumn(colName.getBytes(), value);
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.CounterColumn$CounterColumnTupleSchemeFactory

Copyright © 2018 www.massapicom. 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.