当前位置: 首页>>代码示例>>C++>>正文


C++ NamespaceDetails::notifyOfWriteOp方法代码示例

本文整理汇总了C++中NamespaceDetails::notifyOfWriteOp方法的典型用法代码示例。如果您正苦于以下问题:C++ NamespaceDetails::notifyOfWriteOp方法的具体用法?C++ NamespaceDetails::notifyOfWriteOp怎么用?C++ NamespaceDetails::notifyOfWriteOp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NamespaceDetails的用法示例。


在下文中一共展示了NamespaceDetails::notifyOfWriteOp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runCappedDeleteFromOplogWithLock

    static void runCappedDeleteFromOplogWithLock(const char* ns, BSONObj op) {
        NamespaceDetails* nsd = nsdetails(ns);
        BSONObj row = op[KEY_STR_ROW].Obj();
        BSONObj pk = op[KEY_STR_PK].Obj();

        uint64_t flags = NamespaceDetails::NO_LOCKTREE;
        nsd->deleteObjectFromCappedWithPK(pk, row, flags);
        nsd->notifyOfWriteOp();
    }
开发者ID:lucciano,项目名称:mongo-1,代码行数:9,代码来源:oplog_helpers.cpp

示例2: runCappedInsertFromOplogWithLock

 static void runCappedInsertFromOplogWithLock(
     const char* ns, 
     BSONObj& pk,
     BSONObj& row
     ) 
 {
     NamespaceDetails *nsd = nsdetails(ns);
     // overwrite set to true because we are running on a secondary
     const uint64_t flags = (NamespaceDetails::NO_UNIQUE_CHECKS | NamespaceDetails::NO_LOCKTREE);        
     nsd->insertObjectIntoCappedWithPK(pk, row, flags);
     nsd->notifyOfWriteOp();
 }
开发者ID:lucciano,项目名称:mongo-1,代码行数:12,代码来源:oplog_helpers.cpp

示例3: _insertObjects

    // Does not check magic system collection inserts.
    void _insertObjects(const char *ns, const vector<BSONObj> &objs, bool keepGoing, uint64_t flags, bool logop ) {
        NamespaceDetails *details = getAndMaybeCreateNS(ns, logop);
        for (size_t i = 0; i < objs.size(); i++) {
            const BSONObj &obj = objs[i];
            try {
                uassert( 10059 , "object to insert too large", obj.objsize() <= BSONObjMaxUserSize);
                BSONObjIterator i( obj );
                while ( i.more() ) {
                    BSONElement e = i.next();
                    // check no $ modifiers.  note we only check top level.
                    // (scanning deep would be quite expensive)
                    uassert( 13511 , "document to insert can't have $ fields" , e.fieldName()[0] != '$' );

                    // check no regexp for _id (SERVER-9502)
                    if (str::equals(e.fieldName(), "_id")) {
                        uassert(17033, "can't use a regex for _id", e.type() != RegEx);
                    }
                }
                uassert( 16440 ,  "_id cannot be an array", obj["_id"].type() != Array );

                BSONObj objModified = obj;
                BSONElementManipulator::lookForTimestamps(objModified);
                if (details->isCapped() && logop) {
                    // unfortunate hack we need for capped collections
                    // we do this because the logic for generating the pk
                    // and what subsequent rows to delete are buried in the
                    // namespace details object. There is probably a nicer way
                    // to do this, but this works.
                    details->insertObjectIntoCappedAndLogOps(objModified, flags);
                    details->notifyOfWriteOp();
                }
                else {
                    insertOneObject(details, objModified, flags); // may add _id field
                    if (logop) {
                        OpLogHelpers::logInsert(ns, objModified);
                    }
                }
            } catch (const UserException &) {
                if (!keepGoing || i == objs.size() - 1) {
                    throw;
                }
            }
        }
    }
开发者ID:aberg001,项目名称:mongo,代码行数:45,代码来源:insert.cpp


注:本文中的NamespaceDetails::notifyOfWriteOp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。