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


C++ PersistentTable::allocateNextBlock方法代码示例

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


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

示例1: getPersistentTable

Table* TableFactory::getPersistentTable(
            voltdb::CatalogId databaseId,
            const std::string &name,
            TupleSchema* schema,
            const std::vector<std::string> &columnNames,
            char *signature,
            bool tableIsMaterialized,
            int partitionColumn,
            bool exportEnabled,
            bool exportOnly,
            int tableAllocationTargetSize,
            int tupleLimit,
            int32_t compactionThreshold,
            bool drEnabled)
{
    Table *table = NULL;
    StreamedTable *streamedTable = NULL;
    PersistentTable *persistentTable = NULL;

    if (exportOnly) {
        table = streamedTable = new StreamedTable(partitionColumn);
    }
    else {
        table = persistentTable = new PersistentTable(partitionColumn,
                                                      signature,
                                                      tableIsMaterialized,
                                                      tableAllocationTargetSize,
                                                      tupleLimit,
                                                      drEnabled);
    }

    initCommon(databaseId,
               table,
               name,
               schema,
               columnNames,
               true,  // table will take ownership of TupleSchema object
               compactionThreshold);

    TableStats *stats;
    if (exportOnly) {
        stats = streamedTable->getTableStats();
    }
    else {
        stats = persistentTable->getTableStats();
        // Allocate and assign the tuple storage block to the persistent table ahead of time instead
        // of doing so at time of first tuple insertion. The intent of block allocation ahead of time
        // is to avoid allocation cost at time of tuple insertion
        TBPtr block = persistentTable->allocateNextBlock();
        assert(block->hasFreeTuples());
        persistentTable->m_blocksWithSpace.insert(block);
    }

    // initialize stats for the table
    configureStats(name, stats);

    return table;
}
开发者ID:simonzhangsm,项目名称:voltdb,代码行数:58,代码来源:tablefactory.cpp

示例2: getPersistentTable

Table* TableFactory::getPersistentTable(
            voltdb::CatalogId databaseId,
            const std::string &name,
            TupleSchema* schema,
            const std::vector<std::string> &columnNames,
            char *signature,
            bool tableIsMaterialized,
            int partitionColumn,
            bool exportEnabled,
            bool exportOnly,
            int tableAllocationTargetSize,
            int tupleLimit,
            int32_t compactionThreshold,
            bool drEnabled)
{
    Table *table = NULL;

    if (exportOnly) {
        table = new StreamedTable(exportEnabled);
    }
    else {
        table = new PersistentTable(partitionColumn, signature, tableIsMaterialized, tableAllocationTargetSize, tupleLimit, drEnabled);
    }

    initCommon(databaseId,
               table,
               name,
               schema,
               columnNames,
               true,  // table will take ownership of TupleSchema object
               compactionThreshold);

    // initialize stats for the table
    configureStats(databaseId, name, table);

    if(!exportOnly) {
        // allocate tuple storage block for the persistent table ahead of time
        // instead of waiting till first tuple insertion. Intend of allocating tuple
        // block storage ahead is to improve performance on first tuple insertion.
        PersistentTable *persistentTable = static_cast<PersistentTable*>(table);
        TBPtr block = persistentTable->allocateNextBlock();
        assert(block->hasFreeTuples());
        persistentTable->m_blocksWithSpace.insert(block);
    }
    return table;
}
开发者ID:ingted,项目名称:voltdb,代码行数:46,代码来源:tablefactory.cpp


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