Package com.netflix.astyanax

Examples of com.netflix.astyanax.MutationBatch.withRow()


                    .getKey(rowKey).getCount().execute().getResult();
        Assert.assertEquals(nColumns, count);

        // Delete half of the columns
        m = keyspace.prepareMutationBatch().setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
        rm = m.withRow(CF_STANDARD1, rowKey);

        for (int i = 0; i < nColumns / 2; i++) {
            rm.deleteColumn("" + i);
        }
View Full Code Here


        Assert.assertEquals(nColumns / 2, count);

        // Delete all of the columns
        m = keyspace.prepareMutationBatch().setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
        rm = m.withRow(CF_STANDARD1, rowKey);

        for (int i = 0; i < nColumns; i++) {
            rm.deleteColumn("" + i);
        }
View Full Code Here

    public void testComposite() throws Exception {
        String rowKey = "Composite1";

        boolean bool = false;
        MutationBatch m = keyspace.prepareMutationBatch();
        ColumnListMutation<MockCompositeType> mRow = m.withRow(CF_COMPOSITE, rowKey);
        int columnCount = 0;
        for (char part1 = 'a'; part1 <= 'b'; part1++) {
            for (int part2 = 0; part2 < 10; part2++) {
                for (int part3 = 10; part3 < 11; part3++) {
                    bool = !bool;
View Full Code Here

    /** POPULATE ROWS FOR TESTS */
      MutationBatch m = keyspace.prepareMutationBatch();

        for (char keyName = 'A'; keyName <= 'Z'; keyName++) {
            String rowKey = Character.toString(keyName);
            ColumnListMutation<String> cfmStandard = m.withRow(CF_ALL_ROWS, rowKey);
            for (char cName = 'a'; cName <= 'z'; cName++) {
                cfmStandard.putColumn(Character.toString(cName), (int) (cName - 'a') + 1, null);
            }
            m.withCaching(true);
            m.execute();
View Full Code Here

    @Test
    public void paginateLongColumns() throws Exception {

        String rowKey = "A";
        MutationBatch m = keyspace.prepareMutationBatch();
        ColumnListMutation<Long> cfmLong = m.withRow(CF_LONGCOLUMN, rowKey);
        for (Long l = -10L; l < 10L; l++) {
            cfmLong.putEmptyColumn(l, null);
        }
        cfmLong.putEmptyColumn(Long.MAX_VALUE, null);
        m.execute();
View Full Code Here

 
    @Test
    public void testCompositeKey() {
        MockCompositeType key = new MockCompositeType("A", 1, 2, true, "B");
        MutationBatch m = keyspace.prepareMutationBatch();
        m.withRow(CF_COMPOSITE_KEY, key).putColumn("Test", "Value", null);
        try {
            m.execute();
        } catch (ConnectionException e) {
            LOG.error(e.getMessage(), e);
            Assert.fail();
View Full Code Here

  }
 
  public void insert(int empId, int deptId, String firstName, String lastName) {
    MutationBatch m = keyspace.prepareMutationBatch();

    m.withRow(EMP_CF, empId)
      .putColumn(COL_NAME_EMPID, empId, null)
      .putColumn(COL_NAME_DEPTID, deptId, null)
      .putColumn(COL_NAME_FIRST_NAME, firstName, null)
      .putColumn(COL_NAME_LAST_NAME, lastName, null)
      ;
View Full Code Here

  }
 
  public void insertDynamicProperties(int id, String[] ... entries) {
    MutationBatch m = keyspace.prepareMutationBatch();

    ColumnListMutation<String> clm = m.withRow(EMP_CF, id);
    for(String[] kv : entries) {
      clm.putColumn(kv[0], kv[1], null);
    }
   
    try {
View Full Code Here

    List<MessageContext> readMessagesFromShardUsingLockManager(String shardName, int itemToPop) throws MessageQueueException, BusyLockException {
        ShardLock lock = null;
        try {
            lock = queue.lockManager.acquireLock(shardName);
            MutationBatch m = queue.keyspace.prepareMutationBatch().setConsistencyLevel(queue.consistencyLevel);
            ColumnListMutation<MessageQueueEntry> rowMutation = m.withRow(queue.queueColumnFamily, shardName);
            long curTimeMicros = TimeUUIDUtils.getMicrosTimeFromUUID(TimeUUIDUtils.getUniqueTimeUUIDinMicros());
            return readMessagesInternal(shardName, itemToPop, 0, null, rowMutation, m, curTimeMicros);
        } catch (BusyLockException e) {
            queue.stats.incLockContentionCount();
            throw e;
View Full Code Here

        try {
            // 1. Write the lock column
            lockColumn = MessageQueueEntry.newLockEntry(MessageQueueEntryState.None);
            long curTimeMicros = TimeUUIDUtils.getTimeFromUUID(lockColumn.getTimestamp());
            m = queue.keyspace.prepareMutationBatch().setConsistencyLevel(queue.consistencyLevel);
            m.withRow(queue.queueColumnFamily, shardName).putColumn(lockColumn, curTimeMicros + queue.lockTimeout, queue.lockTtl);
            m.execute();
            // 2. Read back lock columns and entries
            ColumnList<MessageQueueEntry> result = queue.keyspace.prepareQuery(queue.queueColumnFamily).setConsistencyLevel(queue.consistencyLevel).getKey(shardName)
                    .withColumnRange(ShardedDistributedMessageQueue.entrySerializer
                                                                                   .buildRange()
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.