Package com.netflix.astyanax

Examples of com.netflix.astyanax.Keyspace


    ColumnType type = info.getColumnType();
    if(type != ColumnType.ANY_EXCEPT_COMPOSITE) {
      throw new UnsupportedOperationException("Finding on composite type="+colFamily+" not allowed here, you should be using column slice as these rows are HUGE!!!!");
    }
   
    Keyspace keyspace = columnFamilies.getKeyspace();
    CursorKeysToRows cursor = new CursorKeysToRows(rowKeys, batchSize, list, rowProvider);
    cursor.setupMore(keyspace, colFamily, info, cache);
    return cursor;
  }
View Full Code Here


    } catch (ConnectionException e) {
      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);
View Full Code Here

  }
 
  private RowQuery createBasicRowQuery(byte[] rowKey, Info info1, ByteBufferRange range) {
    ColumnFamily cf = info1.getColumnFamilyObj();
   
    Keyspace keyspace = columnFamilies.getKeyspace();
    ColumnFamilyQuery query = keyspace.prepareQuery(cf);
    //ColumnFamilyQuery query = query1.setConsistencyLevel(ConsistencyLevel.CL_QUORUM);
    RowQuery rowQuery = query.getKey(rowKey)
              .autoPaginate(true)
              .withColumnRange(range);
    return rowQuery;
View Full Code Here

      .setDefaultWriteConsistencyLevel(ConsistencyLevel.valueOf("CL_"+CMBProperties.getInstance().getWriteConsistencyLevel())))
          .withConnectionPoolConfiguration(connectionPoolConfiguration)
              .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
              .buildKeyspace(ThriftFamilyFactory.getInstance());
      context.start();
      Keyspace keyspace = context.getClient();
      keyspaces.put(k, keyspace);
    }
  }
View Full Code Here

    @Test
    public void testUniqueness() throws Exception {
        LOG.info("Starting");

        Keyspace keyspace = clusterContext.getEntity().getKeyspace(TEST_KEYSPACE_NAME);

        UniquenessConstraintWithPrefix<Long> unique = new UniquenessConstraintWithPrefix<Long>(
                keyspace, CF_DATA)
                .setTtl(2)
                .setPrefix("unique_")
View Full Code Here

    }

    public static void populateKeyspace() throws Exception {
        LOG.info("Ppoulating keyspace: " + TEST_KEYSPACE_NAME);

        Keyspace keyspace = clusterContext.getEntity().getKeyspace(
                TEST_KEYSPACE_NAME);

        try {
            // CF_Users :
            // 1 :
            // 'A' : 1,
            // 'B' : 2,
            //
            // CF_Index :
            // 'B_Shard1':
            // 2:1 : null
            // 3:2 : null
            //

            MutationBatch m = keyspace.prepareMutationBatch();

            for (long row = 0; row < ROW_COUNT; row++) {
                long value = row * 100;
                m.withRow(CF_DATA, row).putColumn("A", "ABC", null)
                        .putColumn("B", "DEF", null);
View Full Code Here

    @Test
    public void testReverseIndex() throws Exception{
        LOG.info("Starting");
        final AtomicLong counter = new AtomicLong();

        Keyspace keyspace = clusterContext.getEntity().getKeyspace(TEST_KEYSPACE_NAME);
        ReverseIndexQuery
                .newQuery(keyspace, CF_DATA, CF_INDEX.getName(),
                        LongSerializer.get())
                .fromIndexValue(100L)
                .toIndexValue(10000L)
View Full Code Here

                                        "127.0.0.1:9160"))
                .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
                .buildKeyspace(ThriftFamilyFactory.getInstance());

        context.start();
        Keyspace keyspace = context.getEntity();

        MutationBatch m = keyspace.prepareMutationBatch();

        // m.withRow(CF_USER_STATS, "acct1234")
        // .incrementCounterColumn("loginCount", 1);

        try {
            OperationResult<Void> result = m.execute();
        } catch (ConnectionException e) {
            System.out.println(e);
        }

        try {
            OperationResult<ColumnList<String>> result = keyspace
                    .prepareQuery(CF_USER_INFO).getKey("acct1234").execute();
            ColumnList<String> columns = result.getResult();

            // Lookup columns in response by name
            int age = columns.getColumnByName("age").getIntegerValue();
View Full Code Here

                .buildKeyspace(ThriftFamilyFactory.getInstance());

        try {
            keyspaceContext.start();

            Keyspace ks = keyspaceContext.getEntity();

            OperationResult<Void> result = null;
            try {
                MutationBatch m = ks.prepareMutationBatch();
                m.withRow(CF_STANDARD1, "Key1").putColumn("Column2", "Value2",
                        null);
                result = m.execute();
                Assert.fail();
            } catch (ConnectionException e) {
View Full Code Here

        return null;
    }

    @Override
    public Keyspace getKeyspace(String ksName) {
        Keyspace keyspace = keyspaces.get(ksName);
        if (keyspace == null) {
            synchronized (this) {
                Keyspace newKeyspace = new ThriftKeyspaceImpl(ksName, this.connectionPool, this.config, tracerFactory);
                keyspace = keyspaces.putIfAbsent(ksName, newKeyspace);
                if (keyspace == null) {
                    keyspace = newKeyspace;
                }
            }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.Keyspace

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.