本文整理汇总了C++中Slave::logError方法的典型用法代码示例。如果您正苦于以下问题:C++ Slave::logError方法的具体用法?C++ Slave::logError怎么用?C++ Slave::logError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slave
的用法示例。
在下文中一共展示了Slave::logError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SPEHandler
void* Slave::SPEHandler(void* p)
{
Slave* self = ((Param4*)p)->serv_instance;
const string ip = ((Param4*)p)->client_ip;
const int ctrlport = ((Param4*)p)->client_ctrl_port;
const int dataport = ((Param4*)p)->client_data_port;
const int speid = ((Param4*)p)->speid;
const int transid = ((Param4*)p)->transid;
const int key = ((Param4*)p)->key;
const string function = ((Param4*)p)->function;
const int rows = ((Param4*)p)->rows;
const char* param = ((Param4*)p)->param;
const int psize = ((Param4*)p)->psize;
const int type = ((Param4*)p)->type;
const string master_ip = ((Param4*)p)->master_ip;
const int master_port = ((Param4*)p)->master_port;
delete (Param4*)p;
SectorMsg msg;
string lib;
// cout << "rendezvous connect " << ip << " " << dataport << endl;
if (self->m_DataChn.connect(ip, dataport) < 0)
{
self->logError(2, ip, ctrlport, function);
return NULL;
}
// cout << "connected\n";
// read outupt parameters
int buckets;
if (self->m_DataChn.recv4(ip, dataport, transid, buckets) < 0)
return NULL;
SPEDestination dest;
if (buckets > 0)
{
if (self->m_DataChn.recv4(ip, dataport, transid, dest.m_iLocNum) < 0)
return NULL;
int len = dest.m_iLocNum * 80;
if (self->m_DataChn.recv(ip, dataport, transid, dest.m_pcOutputLoc, len) < 0)
return NULL;
len = buckets * 4;
if (self->m_DataChn.recv(ip, dataport, transid, (char*&)dest.m_piLocID, len) < 0)
return NULL;
}
else if (buckets < 0)
{
int32_t len;
if (self->m_DataChn.recv(ip, dataport, transid, dest.m_pcOutputLoc, len) < 0)
return NULL;
dest.m_strLocalFile = dest.m_pcOutputLoc;
}
dest.init(buckets);
// initialize processing function
self->acceptLibrary(key, ip, dataport, transid, lib);
SPHERE_PROCESS process = NULL;
MR_MAP map = NULL;
MR_PARTITION partition = NULL;
void* lh = NULL;
self->openLibrary(key, lib, lh);
if (NULL == lh)
{
self->logError(3, ip, ctrlport, function);
return NULL;
}
if (type == 0)
self->getSphereFunc(lh, function, process);
else if (type == 1)
self->getMapFunc(lh, function, map, partition);
else
return NULL;
timeval t1, t2, t3, t4;
gettimeofday(&t1, 0);
msg.setType(1); // success, return result
msg.setData(0, (char*)&(speid), 4);
SPEResult result;
result.init(buckets);
// processing...
while (true)
{
char* dataseg = NULL;
int size = 0;
if (self->m_DataChn.recv(ip, dataport, transid, dataseg, size) < 0)
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;
if (buckets != -1)
sprintf(dest.m_pcLocalFileID, ".%d", dsid);
//.........这里部分代码省略.........