Esempio n. 1
0
    void Applier::_callback(const ReplicationExecutor::CallbackData& cbd) {
        if (!cbd.status.isOK()) {
            _finishCallback(cbd.status, _operations);
            return;
        }

        invariant(cbd.txn);

        // Refer to multiSyncApply() and multiInitialSyncApply() in sync_tail.cpp.
        cbd.txn->setReplicatedWrites(false);

        // allow us to get through the magic barrier
        cbd.txn->lockState()->setIsBatchWriter(true);

        Status applyStatus(ErrorCodes::InternalError, "not mutated");

        invariant(!_operations.empty());
        for (auto i = _operations.cbegin(); i != _operations.cend(); ++i) {
            try {
                applyStatus = _applyOperation(cbd.txn, *i);
            }
            catch (...) {
                applyStatus = exceptionToStatus();
            }
            if (!applyStatus.isOK()) {
                // 'i' points to last operation that was not applied.
                _finishCallback(applyStatus, Operations(i, _operations.cend()));
                return;
            }
        }
        _finishCallback(_operations.back().getField("ts").timestamp(), Operations());
    }
Esempio n. 2
0
void MultiApplier::_callback(const executor::TaskExecutor::CallbackArgs& cbd) {
    if (!cbd.status.isOK()) {
        _finishCallback(cbd.status, _operations);
        return;
    }

    invariant(!_operations.empty());

    StatusWith<OpTime> applyStatus(ErrorCodes::InternalError, "not mutated");
    try {
        auto txn = cc().makeOperationContext();

        // Refer to multiSyncApply() and multiInitialSyncApply() in sync_tail.cpp.
        txn->setReplicatedWrites(false);

        // allow us to get through the magic barrier
        txn->lockState()->setIsBatchWriter(true);

        applyStatus = _multiApply(txn.get(), _operations, _applyOperation);
    } catch (...) {
        applyStatus = exceptionToStatus();
    }
    if (!applyStatus.isOK()) {
        _finishCallback(applyStatus.getStatus(), _operations);
        return;
    }
    _finishCallback(applyStatus.getValue().getTimestamp(), _operations);
}
Esempio n. 3
0
// TODO change the passed in function to be multiapply instead of apply inlock
void MultiApplier::_callback(const ReplicationExecutor::CallbackArgs& cbd) {
    if (!cbd.status.isOK()) {
        _finishCallback(cbd.status, _operations);
        return;
    }

    invariant(cbd.txn);

    // Refer to multiSyncApply() and multiInitialSyncApply() in sync_tail.cpp.
    cbd.txn->setReplicatedWrites(false);

    // allow us to get through the magic barrier
    cbd.txn->lockState()->setIsBatchWriter(true);

    StatusWith<OpTime> applyStatus(ErrorCodes::InternalError, "not mutated");

    invariant(!_operations.empty());
    try {
        // TODO restructure to support moving _operations into this call. Can't do it today since
        // _finishCallback gets _operations on failure.
        applyStatus = _multiApply(cbd.txn, _operations, _applyOperation);
    } catch (...) {
        applyStatus = exceptionToStatus();
    }
    if (!applyStatus.isOK()) {
        _finishCallback(applyStatus.getStatus(), _operations);
        return;
    }
    _finishCallback(applyStatus.getValue().getTimestamp(), Operations());
}
Esempio n. 4
0
void JAccountPrivate::_q_connected()
{
	Q_Q(JAccount);
	applyStatus(status);
	conferenceManager.data()->syncBookmarks();
	q->resetGroupChatManager(conferenceManager.data()->bookmarkManager());	
	client->setPingInterval(q->config().group("general").value("pingInterval", 30000));
}
Esempio n. 5
0
void JAccountPrivate::_q_connected()
{
	Q_Q(JAccount);
	if (currentPGPKeyId != pgpKeyId) {
		currentPGPKeyId = pgpKeyId;
		emit q->pgpKeyIdChanged(currentPGPKeyId);
	}
	applyStatus(status);
	conferenceManager.data()->syncBookmarks();
	q->resetGroupChatManager(conferenceManager.data()->bookmarkManager());	
	client->setPingInterval(q->config().group("general").value("pingInterval", 30000));
}
Esempio n. 6
0
void StatusWindow::init()
{
    setWindowRole("kadu-status-window");

    QString windowTitle = Container->subStatusContainers().count() > 1
                              ? tr("Change status")
                              : tr("Change account status: %1").arg(Container->statusContainerName());
    setWindowTitle(windowTitle);
    setAttribute(Qt::WA_DeleteOnClose);

    createLayout();

    DescriptionCounter->setVisible(Container->maxDescriptionLength() > 0);

    setupStatusSelect();

    QString description = m_statusSetter->manuallySetStatus(Container->subStatusContainers().first()).description();

    setupDescriptionSelect(description);

    IgnoreNextTextChange = true;
    DescriptionEdit->setPlainText(description);
    descriptionEditTextChanged();   // not connected yet
    IgnoreNextTextChange = false;

    QTextCursor cursor = DescriptionEdit->textCursor();
    cursor.movePosition(QTextCursor::End);
    DescriptionEdit->setTextCursor(cursor);

    DescriptionEdit->setFocus();

    connect(DescriptionSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(descriptionSelected(int)));
    connect(ClearDescriptionsHistoryButton, SIGNAL(clicked(bool)), this, SLOT(clearDescriptionsHistory()));
    connect(DescriptionEdit, SIGNAL(textChanged()), this, SLOT(descriptionEditTextChanged()));
    connect(EraseButton, SIGNAL(clicked(bool)), this, SLOT(eraseDescription()));
    connect(SetStatusButton, SIGNAL(clicked(bool)), this, SLOT(accept()));
    connect(CancelButton, SIGNAL(clicked(bool)), this, SLOT(reject()));
    connect(this, SIGNAL(accepted()), this, SLOT(applyStatus()));

    setFixedSize(sizeHint().expandedTo(QSize(460, 1)));
}