Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.ColumnParent


        String key_user_id = "1";
        long timestamp = System.currentTimeMillis();  

        // insert
        ColumnParent colParent = new ColumnParent("Standard1");
        Column column = new Column("name".getBytes("utf-8"), "Ran".getBytes("UTF-8"), new Clock(timestamp));
       
        client.insert(key_user_id.getBytes(), colParent, column, ConsistencyLevel.ONE);

        // read
View Full Code Here


                                        new TBinaryProtocol(
                                            new TFramedTransportFactory().openTransport(
                                                InetAddress.getLocalHost().getHostName(), 9170)));
        client.set_keyspace(ksName);
        client.insert(bytes(2),
                      new ColumnParent(cfName),
                      getColumnForInsert("v1", 2),
                      org.apache.cassandra.thrift.ConsistencyLevel.ONE);

        assertUpdateIsAugmented(2);
    }
View Full Code Here

        // to make sure we have SSTable
        cfs.forceBlockingFlush();

        // reads to cache key position
        cfs.getColumnFamily(QueryFilter.getSliceFilter(key1,
                                                       new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       false,
                                                       10));

        cfs.getColumnFamily(QueryFilter.getSliceFilter(key2,
                                                       new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       false,
                                                       10));

        assertKeyCacheSize(2, TABLE1, COLUMN_FAMILY1);

        Util.compactAll(cfs).get();
        // after compaction cache should have entries for
        // new SSTables, if we had 2 keys in cache previously it should become 4
        assertKeyCacheSize(4, TABLE1, COLUMN_FAMILY1);

        // re-read same keys to verify that key cache didn't grow further
        cfs.getColumnFamily(QueryFilter.getSliceFilter(key1,
                                                       new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       false,
                                                       10));

        cfs.getColumnFamily(QueryFilter.getSliceFilter(key2,
                                                       new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       false,
                                                       10));
View Full Code Here

        for (int nRows = minRow; nRows < maxRow; nRows++)
        {
            ByteBuffer row = ByteBufferUtil.bytes((rowPrefix + nRows));
            ColumnPath col = new ColumnPath("Standard1").setSuper_column((ByteBuffer)null).setColumn("col1".getBytes());
            ColumnParent parent = new ColumnParent("Standard1").setSuper_column((ByteBuffer)null);

            Collection<InetAddress> endpoints = tester.ringCache.getEndpoint(row);
            InetAddress firstEndpoint = endpoints.iterator().next();
            System.out.printf("hosts with key %s : %s; choose %s%n",
                              new String(row.array()), StringUtils.join(endpoints, ","), firstEndpoint);
View Full Code Here

        timeWithRetry(new RunOp()
        {
            @Override
            public boolean run() throws Exception
            {
                List<?> r = client.get_slice(key, new ColumnParent(type.table), predicate, settings.command.consistencyLevel);
                return r != null && r.size() > 0;
            }

            @Override
            public int partitionCount()
View Full Code Here

        timeWithRetry(new RunOp()
        {
            @Override
            public boolean run() throws Exception
            {
                List<ColumnOrSuperColumn> row = client.get_slice(key, new ColumnParent(type.table), select.predicate(), settings.command.consistencyLevel);
                if (expect == null)
                    return !row.isEmpty();
                if (row == null)
                    return false;
                if (row.size() != expect.size())
View Full Code Here

        for (int nRows = minRow; nRows < maxRow; nRows++)
        {
            ByteBuffer row = ByteBufferUtil.bytes((rowPrefix + nRows));
            ColumnPath col = new ColumnPath("Standard1").setSuper_column((ByteBuffer)null).setColumn("col1".getBytes());
            ColumnParent parent = new ColumnParent("Standard1").setSuper_column((ByteBuffer)null);

            Collection<InetAddress> endpoints = tester.ringCache.getEndpoint(row);
            InetAddress firstEndpoint = endpoints.iterator().next();
            System.out.printf("hosts with key %s : %s; choose %s%n",
                              new String(row.array()), StringUtils.join(endpoints, ","), firstEndpoint);
View Full Code Here

                                     final int ttlInMinutes) {
        template.write(keyspaceName, new KeyspaceCallback<Void>() {
            public Void execute(KeyspaceService keyspace) {
              int ttlInSeconds = (int) TimeUnit.SECONDS.convert(ttlInMinutes, TimeUnit.MINUTES);
                ColumnPath columnPath = createColumnPath(columnFamilyName, superColumnName, propertyName);
                ColumnParent columnParent = new ColumnParent(columnPath.getColumn_family());
                if (columnPath.isSetSuper_column()) {
                  columnParent.setSuper_column(columnPath.getSuper_column());
                }
               
                Column column = new Column(ByteBuffer.wrap(columnPath.getColumn()));
                column.setTtl(ttlInSeconds);
                ByteBuffer key = StringSerializer.get().toByteBuffer(rowKey);
View Full Code Here

                                                                    final String superColumnName,
                                                                    CassandraTemplate template,
                                                                    String keyspaceName) {
        return template.read(keyspaceName, new KeyspaceCallback<Map<String, PropertyValue<?>>>() {
            public Map<String, PropertyValue<?>> execute(KeyspaceService keyspace) {
                ColumnParent columnParent = new ColumnParent(columnFamilyName);
                if (superColumnName != null) {
                    columnParent.setSuper_column(bytes(superColumnName));
                }

                List<Column> list = keyspace.getSlice(rowKey, columnParent, ALL_COLUMNS);
                Map<String, PropertyValue<?>> props = new HashMap<String, PropertyValue<?>>(list.size());
                for (Column c : list) {
View Full Code Here

                                                            String keyspaceName) {

        Map<ByteBuffer, List<Column>> multiGetResult = template
                .read(keyspaceName, new KeyspaceCallback<Map<ByteBuffer, List<Column>>>() {
                    public Map<ByteBuffer, List<Column>> execute(KeyspaceService keyspace) {
                        ColumnParent columnParent = new ColumnParent(columnFamilyName);
                        if (superColumnName != null) {
                            columnParent.setSuper_column(superColumnName);
                        }
                        SlicePredicate slicePredicate = new SlicePredicate();
                        slicePredicate.setColumn_names(Collections.singletonList(columnName));
                        return keyspace.multigetSlice(keys, columnParent, slicePredicate);
                    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.ColumnParent

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.