Package com.netflix.astyanax

Examples of com.netflix.astyanax.MutationBatch


     */
    private void populateMetricsFull() throws Exception {
        final long collectionTimeInSecs = 12345;

        AstyanaxTester at = new AstyanaxTester();
        MutationBatch mb = at.createMutationBatch();
        mb.withRow(at.getStringCF(), locator)
                .putColumn(collectionTimeInSecs, "HTTP GET succeeded")
                .putColumn(collectionTimeInSecs + 1, "HTTP GET failed");
        mb.withRow(at.getStringCF(), otherLocator)
                .putColumn(collectionTimeInSecs + 2, "false");

        mb.execute();
    }
View Full Code Here


        for (int i = 0; i < hours; i++) {
            locators.add(Locator.createLocatorFromPathComponents(tenantId, "test:locator:inserts:" + i));
        }

        AstyanaxTester at = new AstyanaxTester();
        MutationBatch mb = at.createMutationBatch();

        for (Locator locator : locators) {
            int shard = Util.computeShard(locator.toString());
            mb.withRow(at.getLocatorCF(), (long)shard)
                    .putColumn(locator, "", 100000);
        }
        mb.execute();

        return locators;
    }
View Full Code Here

                                        if (processedKeys.get() >= keyLimit) {
                                            return;
                                        }
                                       
                                        // copy the column.
                                        MutationBatch batch = dstKeyspace.prepareMutationBatch();
                                        ColumnListMutation<Long> mutation = batch.withRow(columnFamily, locatorCapture);

                                        assert ttl != 0;
                                        long colCount = 0;
                                        for (Column<Long> c : row.getColumns()) {
                                            mutation.putColumn(c.getName(), c.getByteBufferValue(), ttl);
                                            colCount += 1;
                                        }
                                        columnsTransferred.addAndGet(colCount);
                                       
                                        // save it, submit a log message to be shown later.
                                        try {
                                            batch.execute();
                                            if (verify && random.nextFloat() < VERIFY_PERCENT) {
                                                verifyExecutor.submit(new Runnable() {public void run() {
                                                    try {
                                                        ColumnList<Long> srcData = srcKeyspace.prepareQuery(columnFamily).getKey(locatorCapture)
                                                                .withColumnRange(range)
View Full Code Here

      throw new RuntimeException(e);
    }
  }
  public void sendChangesImpl(List<Action> actions, MetaLookup ormSession) throws ConnectionException {
    Keyspace keyspace = columnFamilies.getKeyspace();
    MutationBatch m = keyspace.prepareMutationBatch();
    //MutationBatch m = m1.setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
   
    for(Action action : actions) {
      if(action instanceof Persist) {
        persist((Persist)action, ormSession, m);
      } else if(action instanceof Remove) {
        remove((Remove)action, ormSession, m);
      } else if(action instanceof PersistIndex) {
        persistIndex((PersistIndex)action, ormSession, m);
      } else if(action instanceof RemoveIndex) {
        removeIndex((RemoveIndex)action, ormSession, m);
      } else if(action instanceof RemoveColumn) {
        removeColumn((RemoveColumn) action, ormSession, m);
      }
    }
   
    long time = System.currentTimeMillis();
        try {
            m.execute();
        } catch (TokenRangeOfflineException e) {
            throw new RuntimeException(
                    "It appears your CL_LEVEL is CL_QUOROM and there are not enough nodes on line to service that request.  Either lower your CL_LEVEL or make sure all nodes are operational");
        }
   
View Full Code Here

      throw new RuntimeException(e);
    }
  }
  public void sendChangesImpl(List<Action> actions, MetaLookup ormSession) throws ConnectionException {
    Keyspace keyspace = columnFamilies.getKeyspace();
    MutationBatch m = keyspace.prepareMutationBatch();
    //MutationBatch m = m1.setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
   
    for(Action action : actions) {
      if(action instanceof Persist) {
        persist((Persist)action, ormSession, m);
      } else if(action instanceof Remove) {
        remove((Remove)action, ormSession, m);
      } else if(action instanceof PersistIndex) {
        persistIndex((PersistIndex)action, ormSession, m);
      } else if(action instanceof RemoveIndex) {
        removeIndex((RemoveIndex)action, ormSession, m);
      }
    }
   
    long time = System.currentTimeMillis();
    m.execute();
   
    if(log.isTraceEnabled()) {
      long total = System.currentTimeMillis()-time;
      log.trace("astyanx save took="+total+" ms");
    }
View Full Code Here

      throw new RuntimeException(e);
    }
  }
  public void sendChangesImpl(List<Action> actions, MetaLookup ormSession) throws ConnectionException {
    Keyspace keyspace = columnFamilies.getKeyspace();
    MutationBatch m = keyspace.prepareMutationBatch();
    //MutationBatch m = m1.setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
   
    for(Action action : actions) {
      if(action instanceof Persist) {
        persist((Persist)action, ormSession, m);
      } else if(action instanceof Remove) {
        remove((Remove)action, ormSession, m);
      } else if(action instanceof PersistIndex) {
        persistIndex((PersistIndex)action, ormSession, m);
      } else if(action instanceof RemoveIndex) {
        removeIndex((RemoveIndex)action, ormSession, m);
      }
    }
   
    long time = System.currentTimeMillis();
    m.execute();
   
    if(log.isTraceEnabled()) {
      long total = System.currentTimeMillis()-time;
      log.trace("astyanx save took="+total+" ms");
    }
View Full Code Here

    }

    @Override
    protected Void run() throws Exception {
        try {
            MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(ConsistencyLevel.CL_QUORUM);

            // Setting columns in a standard column
            ColumnListMutation<String> cm = m.withRow(columnFamily, rowKey);
            for (String key : attributes.keySet()) {
                Object o = attributes.get(key);
                if (o != null) {
                    // unfortunately the 'putColumn' method does not nicely figure out what type the Object is so we need to do it manually
                    if (o instanceof String) {
                        cm.putColumn(key, (String) o, ttlSeconds);
                    } else if (o instanceof Boolean) {
                        cm.putColumn(key, (Boolean) o, ttlSeconds);
                    } else if (o instanceof Integer) {
                        cm.putColumn(key, (Integer) o, ttlSeconds);
                    } else if (o instanceof Long) {
                        cm.putColumn(key, (Long) o, ttlSeconds);
                    } else if (o instanceof Double) {
                        cm.putColumn(key, (Double) o, ttlSeconds);
                    } else if (o instanceof Date) {
                        cm.putColumn(key, (Date) o, ttlSeconds);
                    } else if (o instanceof byte[]) {
                        cm.putColumn(key, (byte[]) o, ttlSeconds);
                    } else if (o instanceof ByteBuffer) {
                        cm.putColumn(key, (ByteBuffer) o, ttlSeconds);
                    } else {
                        throw new IllegalArgumentException("Unsupported object instance type: " + o.getClass().getSimpleName());
                    }
                }
            }
            m.execute();
            return null;
        } catch (ConnectionException e) {
            throw e;
        }
    }
View Full Code Here

      throw new RuntimeException(e);
    }
  }
  public void sendChangesImpl(List<Action> actions, MetaLookup ormSession) throws ConnectionException {
    Keyspace keyspace = columnFamilies.getKeyspace();
    MutationBatch m = keyspace.prepareMutationBatch();
    //MutationBatch m = m1.setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
   
    for(Action action : actions) {
      if(action instanceof Persist) {
        persist((Persist)action, ormSession, m);
      } else if(action instanceof Remove) {
        remove((Remove)action, ormSession, m);
      } else if(action instanceof PersistIndex) {
        persistIndex((PersistIndex)action, ormSession, m);
      } else if(action instanceof RemoveIndex) {
        removeIndex((RemoveIndex)action, ormSession, m);
      } else if(action instanceof RemoveColumn) {
        removeColumn((RemoveColumn) action, ormSession, m);
      }
    }
   
    long time = System.currentTimeMillis();
    m.execute();
   
    if(log.isTraceEnabled()) {
      long total = System.currentTimeMillis()-time;
      log.trace("astyanx save took="+total+" ms");
    }
View Full Code Here

      throw new RuntimeException(e);
    }
  }
  public void sendChangesImpl(List<Action> actions, MetaLookup ormSession) throws ConnectionException {
    Keyspace keyspace = columnFamilies.getKeyspace();
    MutationBatch m = keyspace.prepareMutationBatch();
    //MutationBatch m = m1.setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
   
    for(Action action : actions) {
      if(action instanceof Persist) {
        persist((Persist)action, ormSession, m);
      } else if(action instanceof Remove) {
        remove((Remove)action, ormSession, m);
      } else if(action instanceof PersistIndex) {
        persistIndex((PersistIndex)action, ormSession, m);
      } else if(action instanceof RemoveIndex) {
        removeIndex((RemoveIndex)action, ormSession, m);
      } else if(action instanceof RemoveColumn) {
        removeColumn((RemoveColumn) action, ormSession, m);
      }
    }
   
    long time = System.currentTimeMillis();
    m.execute();
   
    if(log.isTraceEnabled()) {
      long total = System.currentTimeMillis()-time;
      log.trace("astyanx save took="+total+" ms");
    }
View Full Code Here

      throw new RuntimeException(e);
    }
  }
  public void sendChangesImpl(List<Action> actions, MetaLookup ormSession) throws ConnectionException {
    Keyspace keyspace = columnFamilies.getKeyspace();
    MutationBatch m = keyspace.prepareMutationBatch();
    //MutationBatch m = m1.setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
   
    for(Action action : actions) {
      if(action instanceof Persist) {
        persist((Persist)action, ormSession, m);
      } else if(action instanceof Remove) {
        remove((Remove)action, ormSession, m);
      } else if(action instanceof PersistIndex) {
        persistIndex((PersistIndex)action, ormSession, m);
      } else if(action instanceof RemoveIndex) {
        removeIndex((RemoveIndex)action, ormSession, m);
      }
    }
   
    long time = System.currentTimeMillis();
    m.execute();
   
    if(log.isTraceEnabled()) {
      long total = System.currentTimeMillis()-time;
      log.trace("astyanx save took="+total+" ms");
    }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.MutationBatch

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.