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


C++ BSONObj::shallowEqual方法代码示例

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


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

示例1: resumeScan

   INT32 _rtnIXScanner::resumeScan( BOOLEAN isReadOnly )
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY ( SDB__RTNIXSCAN_RESUMESCAN ) ;

      if ( !_indexCB )
      {
         PD_LOG ( PDERROR, "Failed to allocate memory for indexCB" ) ;
         rc = SDB_OOM ;
         goto error ;
      }
      if ( !_indexCB->isInitialized() )
      {
         rc = SDB_RTN_INDEX_NOTEXIST ;
         goto done ;
      }

      if ( _indexCB->getFlag() != IXM_INDEX_FLAG_NORMAL )
      {
         rc = SDB_IXM_UNEXPECTED_STATUS ;
         goto done ;
      }

      if ( !_init || _curIndexRID.isNull() || _savedObj.isEmpty() )
      {
         rc = SDB_OK ;
         goto done ;
      }

      // for write mode, since we write _savedRID and _savedObj in advance, we
      // don't do it here, so let's jump to done directly
      if ( !isReadOnly )
      {
         goto done ;
      }

      // compare the historical index OID with the current index oid, to make
      // sure the index is not changed during the time
      if ( !_indexCB->isStillValid ( _indexOID ) ||
           _indexLID != _indexCB->getLogicalID() )
      {
         rc = SDB_RTN_INDEX_NOTEXIST ;
         goto done ;
      }
      {
      // we assume _indexCB remains valid as long as the indexCBExtent still
      // pointing to the same index oid (which should be unique against each
      // index) because the storage unit should never be remapped in memory
      // during its run
      ixmExtent indexExtent ( _curIndexRID._extent, _su->index() ) ;
      CHAR *dataBuffer = NULL ;
      if ( indexExtent.isStillValid( _indexCB->getMBID() ) )
      {
         dataBuffer = indexExtent.getKeyData ( _curIndexRID._slot ) ;
      }

      if ( dataBuffer )
      {
         try
         {
            BSONObj curObj = ixmKey(dataBuffer).toBson() ;
            // make sure key is the same
            if ( curObj.shallowEqual(_savedObj) )
            {
               dmsRecordID onDiskRID = indexExtent.getRID (
                     _curIndexRID._slot ) ;
               // make sure rid is the same
               if ( onDiskRID == _savedRID )
               {
                  // this means the last scaned record is still here, so let's
                  // reset _savedRID so that we'll call advance()
                  _savedRID.reset() ;
                  // if both key and rid are not changed, let's continue
                  goto done ;
               }
            }
         }
         catch ( std::exception &e )
         {
            PD_LOG ( PDERROR, "Failed to convert buffer to bson from "
                     "current rid: %d,%d: %s", _curIndexRID._extent,
                     _curIndexRID._slot, e.what() ) ;
            rc = SDB_SYS ;
            goto error ;
         }
      }
      // when we get here, it means something changed and we need to
      // relocateRID
      // note relocateRID may relocate to the index that already read. However
      // after advance() returning the RID we'll check if the index already has
      // been read, so we should be save to not reset _savedRID
      {
         rc = relocateRID () ;
         if ( rc )
         {
            PD_LOG ( PDERROR, "Failed to relocate RID, rc: %d", rc ) ;
            goto error ;
         }
      }
      }
//.........这里部分代码省略.........
开发者ID:Andrew8305,项目名称:SequoiaDB,代码行数:101,代码来源:rtnIXScanner.cpp


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