Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.ColumnPath$ColumnPathStandardSchemeFactory


                                                                      final ByteBuffer superColumnName,
                                                                      CassandraTemplate template,
                                                                      String keyspaceName) {
        return template.read(keyspaceName, new KeyspaceCallback<Map<ByteBuffer, SuperColumn>>() {
            public Map<ByteBuffer, SuperColumn> execute(KeyspaceService keyspace) {
                ColumnPath columnPath = createColumnPath(columnFamilyName, superColumnName, null);
                return keyspace.multigetSuperColumn(keys, columnPath);
            }
        });
    }
View Full Code Here


                                             final String superColumnName,
                                             CassandraTemplate template,
                                             String keyspaceName) {
        return template.read(keyspaceName, new KeyspaceCallback<SuperColumn>() {
            public SuperColumn execute(KeyspaceService keyspace) {
                ColumnPath columnPath = createColumnPath(columnFamilyName, superColumnName, null);
                try {
                    return keyspace.getSuperColumn(rowKey, columnPath);
                } catch (HNotFoundException e) {
                    return null;
                }
View Full Code Here

                                               String columnName) {
        return createColumnPath(columnFamily, superColumnName == null ? null : bytes(superColumnName), columnName);
    }

    private static ColumnPath createColumnPath(String columnFamily, ByteBuffer superColumnName, String columnName) {
        ColumnPath columnPath = new ColumnPath(columnFamily);
        if (superColumnName != null) {
            columnPath.setSuper_column(superColumnName);
        }
        if (columnName != null) {
            columnPath.setColumn(bytes(columnName));
        }
        return columnPath;
    }
View Full Code Here

            css_.out.println("Invalid row, super column, or column specification.");
            return;
        }
       
        // Perform a get(), print out the results.
        ColumnPath path = createColumnPath(columnFamily, superColumnName, columnName);
        Column column = thriftClient_.get(tableName, key, path, ConsistencyLevel.ONE).column;
        css_.out.printf("=> (column=%s, value=%s, timestamp=%d)\n", formatColumnName(tableName, columnFamily, column),
                        new String(column.value, "UTF-8"), column.timestamp);
    }
View Full Code Here

        // do some writing.
        final AbstractType comp = ColumnFamily.getComparatorFor("Keyspace1", "Standard1", null);
        for (int i = 0; i < 100; i++)
        {
            RowMutation change = new RowMutation("Keyspace1", ("key" + i).getBytes());
            ColumnPath cp = new ColumnPath("Standard1").setColumn(("colb").getBytes());
            change.add(new QueryPath(cp), ("value" + i).getBytes(), new TimestampClock(0));

            // don't call change.apply().  The reason is that is makes a static call into Table, which will perform
            // local storage initialization, which creates local directories.
            // change.apply();
View Full Code Here

         if (!config.autoCreateKeyspace)
            config.poolProperties.setKeySpace(config.keySpace);
         dataSource = new DataSource(config.getPoolProperties());
         readConsistencyLevel = ConsistencyLevel.valueOf(config.readConsistencyLevel);
         writeConsistencyLevel = ConsistencyLevel.valueOf(config.writeConsistencyLevel);
         entryColumnPath = new ColumnPath(config.entryColumnFamily).setColumn(ENTRY_COLUMN_NAME
                  .getBytes(UTF8Charset));
         entryColumnParent = new ColumnParent(config.entryColumnFamily);
         entryKeyPrefix = ENTRY_KEY_PREFIX + (config.isSharedKeyspace() ? cacheName + "_" : "");
         expirationColumnParent = new ColumnParent(config.expirationColumnFamily);
         expirationKey = ByteBufferUtil.bytes(EXPIRATION_KEY
View Full Code Here

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

        // read
        ColumnPath cp = new ColumnPath("Standard1");
        cp.setColumn("name".getBytes("utf-8"));

        ColumnOrSuperColumn got = client.get(key_user_id.getBytes(), cp,
                ConsistencyLevel.ONE);

        // assert
View Full Code Here

    @PooledConnection
    public void deleteColumn(String keyspace, String column_family, String key, String column,
            ConsistencyLevel consistency_level, boolean purgeIndex) throws InvalidRequestException,
            UnavailableException, TimedOutException, TException, HttpException, IOException {
        ColumnPath path = new ColumnPath(column_family);
        path.setColumn(ByteBufferUtil.bytes(column));
        getConnection(keyspace).remove(ByteBufferUtil.bytes(key), path, System.currentTimeMillis() * 1000,
                consistency_level);

        // TODO: Revisit deleting a single field because it requires a fetch
        // first.
View Full Code Here

    @PooledConnection
    public long deleteRow(String keyspace, String column_family, String key, ConsistencyLevel consistency_level,
            boolean purgeIndex) throws InvalidRequestException, UnavailableException, TimedOutException, TException,
            HttpException, IOException {
        long deleteTime = System.currentTimeMillis() * 1000;
        ColumnPath path = new ColumnPath(column_family);
        getConnection(keyspace).remove(ByteBufferUtil.bytes(key), path, deleteTime, consistency_level);

        // Update Index
        if (config.isIndexingEnabled() && purgeIndex) {
            indexer.delete(column_family, key);
View Full Code Here

    @PooledConnection
    public String getColumn(String keyspace, String columnFamily, String key, String column,
            ConsistencyLevel consistencyLevel) throws InvalidRequestException, NotFoundException, UnavailableException,
            TimedOutException, TException, UnsupportedEncodingException {
        ColumnPath path = new ColumnPath(columnFamily);
        path.setColumn(ByteBufferUtil.bytes(column));
        ColumnOrSuperColumn column_result = getConnection(keyspace).get(ByteBufferUtil.bytes(key), path,
                consistencyLevel);
        return new String(column_result.getColumn().getValue(), "UTF8");
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.ColumnPath$ColumnPathStandardSchemeFactory

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.