Example #1
0
std::unique_ptr<OperationContext> ServiceContextMongoD::_newOpCtx(Client* client, unsigned opId) {
    invariant(&cc() == client);
    auto opCtx = stdx::make_unique<OperationContext>(client, opId);

    if (isMMAPV1()) {
        opCtx->setLockState(stdx::make_unique<MMAPV1LockerImpl>());
    } else {
        opCtx->setLockState(stdx::make_unique<DefaultLockerImpl>());
    }

    opCtx->setRecoveryUnit(getGlobalStorageEngine()->newRecoveryUnit(),
                           OperationContext::kNotInUnitOfWork);
    return opCtx;
}
Example #2
0
QStealthStatusBar::QStealthStatusBar(QWidget *parent) :
    QLabel(parent)
{
    setStyleSheet(SC_QSS_BOTTOM_BAR);

    for (int i = 0; i < SC_TRAY_ITEM_COUNT; i++) {
        lblIcons[i] = new QLabel(this);
        lblIcons[i]->setGeometry(5 + 35 * (i + 1), 10, 30, 30);
        setActive(i, true);
    }
    setActive(SC_STATUS_ID_CHECK, false);

    btnLock = new QPushButton(this);
    btnLock->setGeometry(0, 10, 30, 30);
    setLockState(SC_LS_UNLOCKED);
}
ServiceContext::UniqueOperationContext ServiceContext::makeOperationContext(Client* client) {
    auto opCtx = std::make_unique<OperationContext>(client, _nextOpId.fetchAndAdd(1));
    onCreate(opCtx.get(), _clientObservers);
    if (!opCtx->lockState()) {
        opCtx->setLockState(std::make_unique<LockerNoop>());
    }
    if (!opCtx->recoveryUnit()) {
        opCtx->setRecoveryUnit(std::make_unique<RecoveryUnitNoop>(),
                               WriteUnitOfWork::RecoveryUnitState::kNotInUnitOfWork);
    }
    {
        stdx::lock_guard<Client> lk(*client);
        client->setOperationContext(opCtx.get());
    }
    return UniqueOperationContext(opCtx.release());
};