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


C++ Slave::SPEReadData方法代码示例

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


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

示例1: SPEHandler


//.........这里部分代码省略.........
   // processing...
   while (init_success)
   {
      char* dataseg = NULL;
      int size = 0;
      if (self->m_DataChn.recv(ip, dataport, transid, dataseg, size) < 0)
         break;

      // client request to close this SPE
      if (size < 20)
         break;

      // read data segment parameters
      int64_t offset = *(int64_t*)(dataseg);
      int64_t totalrows = *(int64_t*)(dataseg + 8);
      int32_t dsid = *(int32_t*)(dataseg + 16);
      string datafile = dataseg + 20;
      sprintf(dest.m_pcLocalFileID, ".%d", dsid);
      delete [] dataseg;

      self->m_SectorLog << LogStart(LogLevel::LEVEL_3) << "new job " << datafile << " " << offset << " " << totalrows << LogEnd();

      int64_t* index = NULL;
      if ((totalrows > 0) && (rows != 0))
         index = new int64_t[totalrows + 1];
      char* block = NULL;
      int unitrows = (rows != -1) ? rows : totalrows;
      int progress = 0;

      // read data
      if (0 != rows)
      {
         size = 0;
         if (self->SPEReadData(datafile, offset, size, index, totalrows, block) <= 0)
         {
            delete [] index;
            delete [] block;

            progress = SectorError::E_SPEREAD;
            msg.setData(4, (char*)&progress, 4);
            msg.m_iDataLength = SectorMsg::m_iHdrSize + 8;
            int id = 0;
            self->m_GMP.sendto(ip.c_str(), ctrlport, id, &msg);

            continue;
         }
      }
      else
      {
         // store file name in "process" parameter
         block = new char[datafile.length() + 1];
         strcpy(block, datafile.c_str());
         size = datafile.length() + 1;
         totalrows = 0;
      }

      SInput input;
      input.m_pcUnit = NULL;
      input.m_pcParam = (char*)param;
      input.m_iPSize = psize;
      SOutput output;
      output.m_iBufSize = (size < 64000000) ? 64000000 : size;
      output.m_pcResult = new char[output.m_iBufSize];
      output.m_iIndSize = (totalrows < 640000) ? 640000 : totalrows + 2;
      output.m_pllIndex = new int64_t[output.m_iIndSize];
      output.m_piBucketID = new int[output.m_iIndSize];
开发者ID:norouzi4d,项目名称:sector,代码行数:67,代码来源:serv_spe.cpp


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