当前位置: 首页>>代码示例>>Java>>正文


Java StorageProxy.read方法代码示例

本文整理汇总了Java中org.apache.cassandra.service.StorageProxy.read方法的典型用法代码示例。如果您正苦于以下问题:Java StorageProxy.read方法的具体用法?Java StorageProxy.read怎么用?Java StorageProxy.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.service.StorageProxy的用法示例。


在下文中一共展示了StorageProxy.read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private ResultMessage.Rows execute(Pageable command, QueryOptions options, int limit, long now, QueryState state) throws RequestValidationException, RequestExecutionException
{
    List<Row> rows;
    if (command == null)
    {
        rows = Collections.<Row>emptyList();
    }
    else
    {
        rows = command instanceof Pageable.ReadCommands
             ? StorageProxy.read(((Pageable.ReadCommands)command).commands, options.getConsistency(), state.getClientState())
             : StorageProxy.getRangeSlice((RangeSliceCommand)command, options.getConsistency());
    }

    return processResults(rows, options, limit, now);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:SelectStatement.java

示例2: queryNextPage

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestValidationException, RequestExecutionException
{
    // For some queries, such as a DISTINCT query on static columns, the limit for slice queries will be lower
    // than the page size (in the static example, it will be 1).  We use the min here to ensure we don't fetch
    // more rows than we're supposed to.  See CASSANDRA-8108 for more details.
    SliceQueryFilter filter = command.filter.withUpdatedCount(Math.min(command.filter.count, pageSize));
    if (lastReturned != null)
        filter = filter.withUpdatedStart(lastReturned, cfm.comparator);

    logger.debug("Querying next page of slice query; new filter: {}", filter);
    ReadCommand pageCmd = command.withUpdatedFilter(filter);
    return localQuery
         ? Collections.singletonList(pageCmd.getRow(Keyspace.open(command.ksName)))
         : StorageProxy.read(Collections.singletonList(pageCmd), consistencyLevel, cstate);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:SliceQueryPager.java

示例3: execute

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private ResultMessage.Rows execute(Pageable command, ConsistencyLevel cl, List<ByteBuffer> variables, int limit, long now) throws RequestValidationException, RequestExecutionException
{
    List<Row> rows;
    if (command == null)
    {
        rows = Collections.<Row>emptyList();
    }
    else
    {
        rows = command instanceof Pageable.ReadCommands
             ? StorageProxy.read(((Pageable.ReadCommands)command).commands, cl)
             : StorageProxy.getRangeSlice((RangeSliceCommand)command, cl);
    }

    return processResults(rows, variables, limit, now);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:17,代码来源:SelectStatement.java

示例4: retryDummyRead

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void retryDummyRead(String ks, String cf) throws PermanentBackendException {

        final long limit = System.currentTimeMillis() + (60L * 1000L);

        while (System.currentTimeMillis() < limit) {
            try {
                SortedSet<ByteBuffer> ss = new TreeSet<ByteBuffer>();
                ss.add(ByteBufferUtil.zeroByteBuffer(1));
                NamesQueryFilter nqf = new NamesQueryFilter(ss);
                SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(ks, ByteBufferUtil.zeroByteBuffer(1), cf, 1L, nqf);
                StorageProxy.read(ImmutableList.<ReadCommand> of(cmd), ConsistencyLevel.QUORUM);
                log.info("Read on CF {} in KS {} succeeded", cf, ks);
                return;
            } catch (Throwable t) {
                log.warn("Failed to read CF {} in KS {} following creation", cf, ks, t);
            }

            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                throw new PermanentBackendException(e);
            }
        }

        throw new PermanentBackendException("Timed out while attempting to read CF " + cf + " in KS " + ks + " following creation");
    }
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:27,代码来源:CassandraEmbeddedStoreManager.java

示例5: execute

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private ResultMessage.Rows execute(Pageable command, QueryOptions options, int limit, long now) throws RequestValidationException, RequestExecutionException
{
    List<Row> rows;
    if (command == null)
    {
        rows = Collections.<Row>emptyList();
    }
    else
    {
    	//@daidong we shall fall into the first category: calling StorageProxy.read().
    	//StorageProxy.read() still use the List<ReadCommand> as parameter instead of Pageable.ReadCommands
        rows = command instanceof Pageable.ReadCommands
             ? StorageProxy.read(((Pageable.ReadCommands)command).commands, options.getConsistency())
             : StorageProxy.getRangeSlice((RangeSliceCommand)command, options.getConsistency());
    }

    //@daidong still need to process the outputs before returning. From List<Row> to ResultMessage.Rows.
    //basically, the processing is to encode the Rows into a formation we can send to client.
    return processResults(rows, options, limit, now);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:21,代码来源:SelectStatement.java

示例6: execute

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
public ResultMessage.Rows execute(ConsistencyLevel cl, QueryState state, List<ByteBuffer> variables) throws RequestExecutionException, RequestValidationException
{
    if (cl == null)
        throw new InvalidRequestException("Invalid empty consistency level");

    cl.validateForRead(keyspace());

    List<Row> rows;
    if (isKeyRange)
    {
        RangeSliceCommand command = getRangeCommand(variables);
        rows = command == null ? Collections.<Row>emptyList() : StorageProxy.getRangeSlice(command, cl);
    }
    else
    {
        List<ReadCommand> commands = getSliceCommands(variables);
        rows = commands == null ? Collections.<Row>emptyList() : StorageProxy.read(commands, cl);
    }

    return processResults(rows, variables);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:22,代码来源:SelectStatement.java

示例7: remoteStorageQuery

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
public static ColumnFamily remoteStorageQuery(String target, String dataTag){
	try {
		List<ReadCommand> command = new ArrayList<ReadCommand>();
		command.add(new SliceFromReadCommand(
				Metadata.MetaData_KS,
				ByteBufferUtil.bytes(target), 
				new QueryPath(Metadata.MetadataLog_CF),
				Column.decomposeName(String.valueOf(0) , "", dataTag, "value"),
				Column.decomposeName(String.valueOf(Long.MAX_VALUE) , "", dataTag, "value"),
				false,
				Integer.MAX_VALUE));

		List<Row> rows = StorageProxy.read(command, ConsistencyLevel.ANY);
		return rows.get(0).cf;
		 
	} catch (Exception e) {
		return null;
	}
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:MetadataLog.java

示例8: remoteStorageQuery

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private ColumnFamily remoteStorageQuery(String target, String dataTag){
	try {
		List<ReadCommand> command = new ArrayList<ReadCommand>();
		command.add(new SliceFromReadCommand(
				Metadata.MetaData_KS,
				ByteBufferUtil.bytes(target), 
				new QueryPath(Metadata.MetadataRegistry_CF),
				Column.decomposeName(dataTag, "admin_tag"),
				Column.decomposeName(dataTag, "admin_tag"),
				false,
				Integer.MAX_VALUE));

		List<Row> rows = StorageProxy.read(command, ConsistencyLevel.ANY);
		return rows.get(0).cf;
		 
	} catch (Exception e) {
		return null;
	}
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:MetadataRegistry.java

示例9: execute

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private ResultMessage.Rows execute(Pageable command, ConsistencyLevel cl, List<ByteBuffer> variables, int limit, long now) throws RequestValidationException, RequestExecutionException
{
    
    logger.info(">>> STRATIO >>> SelectStatement.execute(...5)");
    
    List<Row> rows;
    if (command == null)
    {
        rows = Collections.<Row>emptyList();
    }
    else
    {
        rows = command instanceof Pageable.ReadCommands
             ? StorageProxy.read(((Pageable.ReadCommands)command).commands, cl)
             : StorageProxy.getRangeSlice((RangeSliceCommand)command, cl);
    }

    return processResults(rows, variables, limit, now);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:20,代码来源:SelectStatement.java

示例10: retryDummyRead

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void retryDummyRead(String ks, String cf) throws PermanentBackendException {

        final long limit = System.currentTimeMillis() + (60L * 1000L);

        while (System.currentTimeMillis() < limit) {
            try {
                SortedSet<CellName> names = new TreeSet<>(new Comparator<CellName>() {
                    // This is a singleton set.  We need to define a comparator because SimpleDenseCellName is not
                    // comparable, but it doesn't have to be a useful comparator
                    @Override
                    public int compare(CellName o1, CellName o2)
                    {
                        return 0;
                    }
                });
                names.add(CellNames.simpleDense(ByteBufferUtil.zeroByteBuffer(1)));
                NamesQueryFilter nqf = new NamesQueryFilter(names);
                SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(ks, ByteBufferUtil.zeroByteBuffer(1), cf, 1L, nqf);
                StorageProxy.read(ImmutableList.<ReadCommand> of(cmd), ConsistencyLevel.QUORUM);
                log.info("Read on CF {} in KS {} succeeded", cf, ks);
                return;
            } catch (Throwable t) {
                log.warn("Failed to read CF {} in KS {} following creation", cf, ks, t);
            }

            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                throw new PermanentBackendException(e);
            }
        }

        throw new PermanentBackendException("Timed out while attempting to read CF " + cf + " in KS " + ks + " following creation");
    }
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:35,代码来源:CassandraEmbeddedStoreManager.java

示例11: readColumnFamily

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
protected Map<DecoratedKey, ColumnFamily> readColumnFamily(List<ReadCommand> commands, org.apache.cassandra.db.ConsistencyLevel consistency_level, ClientState cState)
throws org.apache.cassandra.exceptions.InvalidRequestException, UnavailableException, TimedOutException
{
    // TODO - Support multiple column families per row, right now row only contains 1 column family
    Map<DecoratedKey, ColumnFamily> columnFamilyKeyMap = new HashMap<DecoratedKey, ColumnFamily>();

    List<Row> rows = null;
    try
    {
        schedule(DatabaseDescriptor.getReadRpcTimeout());
        try
        {
            rows = StorageProxy.read(commands, consistency_level, cState);
        }
        finally
        {
            release();
        }
    }
    catch (RequestExecutionException e)
    {
        ThriftConversion.rethrow(e);
    }

    for (Row row: rows)
    {
        columnFamilyKeyMap.put(row.key, row.cf);
    }
    return columnFamilyKeyMap;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:31,代码来源:CassandraServer.java

示例12: queryNextPage

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestValidationException, RequestExecutionException
{
    SliceQueryFilter filter = command.filter.withUpdatedCount(pageSize);
    if (lastReturned != null)
        filter = filter.withUpdatedStart(lastReturned, cfm.comparator);

    ReadCommand pageCmd = command.withUpdatedFilter(filter);
    return localQuery
         ? Collections.singletonList(pageCmd.getRow(Keyspace.open(command.ksName)))
         : StorageProxy.read(Collections.singletonList(pageCmd), consistencyLevel);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:13,代码来源:SliceQueryPager.java

示例13: readColumnFamily

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
protected Map<DecoratedKey, ColumnFamily> readColumnFamily(List<ReadCommand> commands, org.apache.cassandra.db.ConsistencyLevel consistency_level)
throws org.apache.cassandra.exceptions.InvalidRequestException, UnavailableException, TimedOutException
{
    // TODO - Support multiple column families per row, right now row only contains 1 column family
    Map<DecoratedKey, ColumnFamily> columnFamilyKeyMap = new HashMap<DecoratedKey, ColumnFamily>();

    List<Row> rows = null;
    try
    {
        schedule(DatabaseDescriptor.getReadRpcTimeout());
        try
        {
            rows = StorageProxy.read(commands, consistency_level);
        }
        finally
        {
            release();
        }
    }
    catch (RequestExecutionException e)
    {
        ThriftConversion.rethrow(e);
    }

    for (Row row: rows)
    {
        columnFamilyKeyMap.put(row.key, row.cf);
    }
    return columnFamilyKeyMap;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:31,代码来源:CassandraServer.java

示例14: queryNextPage

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestValidationException, RequestExecutionException
{
    SliceQueryFilter filter = command.filter.withUpdatedCount(pageSize);
    if (lastReturned != null)
        filter = filter.withUpdatedStart(lastReturned, cfm.comparator);

    logger.debug("Querying next page of slice query; new filter: {}", filter);
    ReadCommand pageCmd = command.withUpdatedFilter(filter);
    return localQuery
         ? Collections.singletonList(pageCmd.getRow(Keyspace.open(command.ksName)))
         : StorageProxy.read(Collections.singletonList(pageCmd), consistencyLevel);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:14,代码来源:SliceQueryPager.java

示例15: execute

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
public PartitionIterator execute(ConsistencyLevel consistency, ClientState clientState) throws RequestExecutionException
{
    return StorageProxy.read(Group.one(this), consistency, clientState);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:5,代码来源:SinglePartitionReadCommand.java


注:本文中的org.apache.cassandra.service.StorageProxy.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。