本文整理汇总了C++中SharedDatabase::getDataSegment方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedDatabase::getDataSegment方法的具体用法?C++ SharedDatabase::getDataSegment怎么用?C++ SharedDatabase::getDataSegment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedDatabase
的用法示例。
在下文中一共展示了SharedDatabase::getDataSegment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: beginTxn
void CmdInterpreter::beginTxn(ProxyBeginTxnCmd &cmd, bool readOnly, TxnId csn)
{
assert(readOnly || csn == NULL_TXN_ID);
// block checkpoints during this method
DbHandle *pDbHandle = getDbHandle(cmd.getDbHandle());
SharedDatabase pDb = pDbHandle->pDb;
SXMutexSharedGuard actionMutexGuard(
pDb->getCheckpointThread()->getActionMutex());
std::auto_ptr<TxnHandle> pTxnHandle(newTxnHandle());
JniUtil::incrementHandleCount(TXNHANDLE_TRACE_TYPE_STR, pTxnHandle.get());
pTxnHandle->pDb = pDb;
pTxnHandle->readOnly = readOnly;
// TODO: CacheAccessor factory
pTxnHandle->pTxn = pDb->getTxnLog()->newLogicalTxn(pDb->getCache());
pTxnHandle->pResourceGovernor = pDbHandle->pResourceGovernor;
// NOTE: use a null scratchAccessor; individual ExecStreamGraphs
// will have their own
SegmentAccessor scratchAccessor;
pTxnHandle->pFtrsTableWriterFactory = SharedFtrsTableWriterFactory(
new FtrsTableWriterFactory(
pDb,
pDb->getCache(),
pDb->getTypeFactory(),
scratchAccessor));
// If snapshots are enabled, set up 2 snapshot segments -- one of which
// only reads committed data. This will be used for streams that need to
// read a snapshot of the data before other portions of the stream graph
// have modified the segment.
if (pDb->areSnapshotsEnabled()) {
if (csn == NULL_TXN_ID) {
csn = pTxnHandle->pTxn->getTxnId();
}
pTxnHandle->pSnapshotSegment =
pDb->getSegmentFactory()->newSnapshotRandomAllocationSegment(
pDb->getDataSegment(),
pDb->getDataSegment(),
csn,
false);
pTxnHandle->pReadCommittedSnapshotSegment =
pDb->getSegmentFactory()->newSnapshotRandomAllocationSegment(
pDb->getDataSegment(),
pDb->getDataSegment(),
csn,
true);
} else {
assert(csn == NULL_TXN_ID);
}
setTxnHandle(cmd.getResultHandle(), pTxnHandle.release());
}