Example #1
0
void FreeMonStorage::replace(OperationContext* opCtx, const FreeMonStorageState& doc) {
    BSONObj deleteKey = BSON("_id" << kFreeMonDocIdKey);
    BSONElement elementKey = deleteKey.firstElement();

    BSONObj obj = doc.toBSON();

    auto storageInterface = repl::StorageInterface::get(opCtx);
    AutoGetCollection autoWrite(opCtx, NamespaceString::kServerConfigurationNamespace, MODE_IX);

    if (repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(
            opCtx, NamespaceString::kServerConfigurationNamespace)) {
        auto swObj = storageInterface->upsertById(
            opCtx, NamespaceString::kServerConfigurationNamespace, elementKey, obj);
        if (!swObj.isOK()) {
            uassertStatusOK(swObj);
        }
    }
}
Example #2
0
void FreeMonStorage::deleteState(OperationContext* opCtx) {
    BSONObj deleteKey = BSON("_id" << kFreeMonDocIdKey);
    BSONElement elementKey = deleteKey.firstElement();

    auto storageInterface = repl::StorageInterface::get(opCtx);
    AutoGetCollection autoWrite(opCtx, NamespaceString::kServerConfigurationNamespace, MODE_IX);

    if (repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(
            opCtx, NamespaceString::kServerConfigurationNamespace)) {

        auto swObj = storageInterface->deleteById(
            opCtx, NamespaceString::kServerConfigurationNamespace, elementKey);
        if (!swObj.isOK()) {
            // Ignore errors about no document
            if (swObj.getStatus() == ErrorCodes::NoSuchKey) {
                return;
            }

            uassertStatusOK(swObj);
        }
    }
}
Example #3
0
/*!
 * Checks which mechanism is used to read/write data
 * @return  true if flushData is used, false if internal pointer to data is used
 */
bool VTKField::usesInterface( )const{ 

    return( !autoWrite() && !implicitKnown ) ;
};