示例#1
0
std::unique_ptr<WriteConcernOptions> SettingsType::getWriteConcern() const {
    dassert(_key.is_initialized());
    dassert(_key == BalancerDocKey);

    if (isSecondaryThrottleSet() && !getSecondaryThrottle()) {
        return stdx::make_unique<WriteConcernOptions>(1, WriteConcernOptions::NONE, 0);
    } else if (!isMigrationWriteConcernSet()) {
        // Default setting.
        return nullptr;
    } else {
        return stdx::make_unique<WriteConcernOptions>(getMigrationWriteConcern());
    }
}
示例#2
0
    BSONObj SettingsType::toBSON() const {
        BSONObjBuilder builder;

        if (_key) builder.append(key(), getKey());
        if (_chunkSize) builder.append(chunkSize(), getChunkSize());
        if (_balancerStopped) builder.append(balancerStopped(), getBalancerStopped());
        if (_secondaryThrottle) {
            builder.append(deprecated_secondaryThrottle(), getSecondaryThrottle());
        }
        if (_migrationWriteConcern) {
            builder.append(migrationWriteConcern(), getMigrationWriteConcern().toBSON());
        }
        if (_waitForDelete) builder.append(waitForDelete(), getWaitForDelete());

        return builder.obj();
    }