QByteArray OpApprovalTaskOutcomeResp::marshall() { QByteArray serialized_data; QDataStream stream(&serialized_data, QIODevice::WriteOnly); stream << opStatus(); stream << taskId(); return serialized_data; }
void FileTransferSocket::_fileLoginResponse(CImPdu* pdu) { CImPduClientFileLoginRes* pData = (CImPduClientFileLoginRes*)pdu; if (!pData || pData->GetResult() != 0) { APP_LOG(LOG_ERROR, _T("file server login failed! ")); return; } //打开文件 std::string taskId(pData->GetTaskId(), pData->GetTaskIdLen()); TransferFileEntity fileEntity; if (!TransferFileEntityManager::getInstance()->getFileInfoByTaskId(taskId, fileEntity)) { APP_LOG(LOG_ERROR, _T("file server login:can't find the fileInfo ")); return; } APP_LOG(LOG_INFO, _T("file server login succeed")); //提示界面,界面上插入该项 if (CLIENT_REALTIME_SENDER == fileEntity.nClientMode || CLIENT_OFFLINE_UPLOAD == fileEntity.nClientMode) { logic::GetLogic()->asynNotifyObserver(module::KEY_FILETRANSFER_SENDFILE, fileEntity.sTaskID); } else if (CLIENT_REALTIME_RECVER == fileEntity.nClientMode || CLIENT_OFFLINE_DOWNLOAD == fileEntity.nClientMode) { logic::GetLogic()->asynNotifyObserver(module::KEY_FILETRANSFER_REQUEST, fileEntity.sTaskID); } }
void interruptWorkerTask (Task *task) { ASSERT(osThreadId() != task->id); // seppuku not allowed ASSERT(task->incall->suspended_tso); // use this only for FFI calls interruptOSThread(task->id); debugTrace(DEBUG_sched, "interrupted worker task %p", taskId(task)); }
Note::Note(const QString& id, QObject* parent) : com::noughmad::toutatis::Note(Service, "/Note/" + cleanId(id), QDBusConnection::sessionBus(), parent) , d_ptr(new NotePrivate) { Q_D(Note); d->task = getOrCreateModel<Task>(parent, taskId(), this); Q_ASSERT(d->task->isValid()); }
void Event::dump() const { qDebug() << "[Event" << id() << "] - task " << taskId() << " - start: " << startDateTime() << " - end: " << endDateTime() << " - duration: " << duration() << "seconds - comment:" << comment(); }
void FileTransferSocket::_filePullDataRspResponse(CImPdu* pdu)//收 { CImPduClientFilePullDataRsp* pDataRsp = (CImPduClientFilePullDataRsp*)pdu; UInt32 nRes = pDataRsp->GetResult(); if (FILE_SERVER_ERRNO_OK != nRes) { APP_LOG(LOG_ERROR, _T("PullDataRspResponse: error result:%d"),nRes); return; } std::string taskId(pDataRsp->GetTaskId(), pDataRsp->GetTaskIdLen()); void* pData = pDataRsp->GetData(); UInt32 fileSize = pDataRsp->GetDataSize(); UInt32 fileOffset = pDataRsp->GetOffset(); TransferFileEntity fileEntity; if (!TransferFileEntityManager::getInstance()->getFileInfoByTaskId(taskId, fileEntity)) { APP_LOG(LOG_ERROR, _T("PullDataRspResponse: can't find the fileInfo")); return; } APP_LOG(LOG_DEBUG, _T("receive:taskId=%s,filesize=%d,name=%s") , util::stringToCString(fileEntity.sTaskID) , fileEntity.nFileSize , fileEntity.getRealFileName()); //存文件... if (!fileEntity.pFileObject->writeBlock(fileOffset, fileSize, pData)) { APP_LOG(LOG_DEBUG, _T("FileTransferSocket::_filePullDataRspResponse-writeBlock failed ")); return; } fileEntity.nProgress = fileOffset + fileSize; if (fileEntity.nProgress <= fileEntity.nFileSize) { //更新进度条 TransferFileEntityManager::getInstance()->updateFileInfoBysTaskID(fileEntity);//保存当前进度 logic::GetLogic()->asynNotifyObserver(module::KEY_FILESEVER_UPDATA_PROGRESSBAR, fileEntity.sTaskID); //继续发file block req... int mode = fileEntity.nClientMode == CLIENT_OFFLINE_DOWNLOAD ? FILE_TYPE_OFFLINE : FILE_TYPE_ONLINE; CImPduClientFilePullDataReq pduPullDataReq(taskId.c_str(), fileEntity.sToID.c_str() , mode, fileEntity.nProgress, fileSize); sendPacket(&pduPullDataReq); } else//传输完成 { if (fileEntity.pFileObject) { delete fileEntity.pFileObject; fileEntity.pFileObject = nullptr; } TransferFileEntityManager::getInstance()->updateFileInfoBysTaskID(fileEntity); logic::GetLogic()->asynNotifyObserver(module::KEY_FILESEVER_PROGRESSBAR_FINISHED, fileEntity.sTaskID); } }
bool Event::operator == ( const Event& other ) const { return ( other.id() == id() && other.installationId() == installationId() && other.taskId() == taskId() && other.comment() == comment() && other.startDateTime() == startDateTime() && other.endDateTime() == endDateTime() && other.userId() == userId() && other.reportId() == reportId() ); }
void FileTransferSocket::_fileState(CImPdu* pdu) { CImPduClientFileState* pData = (CImPduClientFileState*)pdu; UINT32 nfileState = pData->GetState(); std::string taskId(pData->GetTaskId(), pData->GetTaskIdLen()); TransferFileEntity fileEntity; if (!TransferFileEntityManager::getInstance()->getFileInfoByTaskId(taskId, fileEntity)) { APP_LOG(LOG_ERROR, _T("_fileState:can't find the fileInfo ")); return; } switch (nfileState) { case CLIENT_FILE_PEER_READY: APP_LOG(LOG_DEBUG, _T("FileTransferSocket::_fileState--CLIENT_FILE_PEER_READY ")); break; case CLIENT_FILE_CANCEL://取消的了文件传输 APP_LOG(LOG_DEBUG, _T("FileTransferSocket::_fileState--CLIENT_FILE_CANCEL ")); { delete fileEntity.pFileObject; fileEntity.pFileObject = nullptr; TransferFileEntityManager::getInstance()->updateFileInfoBysTaskID(fileEntity); logic::GetLogic()->asynNotifyObserver(module::KEY_FILESEVER_UPDATA_CANCEL, fileEntity.sTaskID); } break; case CLIENT_FILE_REFUSE: APP_LOG(LOG_DEBUG, _T("FileTransferSocket::_fileState--CLIENT_FILE_REFUSE ")); { delete fileEntity.pFileObject; fileEntity.pFileObject = nullptr; TransferFileEntityManager::getInstance()->updateFileInfoBysTaskID(fileEntity); logic::GetLogic()->asynNotifyObserver(module::KEY_FILESEVER_UPDATA_REJECT, fileEntity.sTaskID); } break; case CLIENT_FILE_DONE: APP_LOG(LOG_DEBUG, _T("FileTransferSocket::_fileState--CLIENT_FILE_DONE ")); if (fileEntity.pFileObject) { delete fileEntity.pFileObject; fileEntity.pFileObject = nullptr; } TransferFileEntityManager::getInstance()->updateFileInfoBysTaskID(fileEntity); logic::GetLogic()->asynNotifyObserver(module::KEY_FILESEVER_PROGRESSBAR_FINISHED, fileEntity.sTaskID); break; default: break; } }
uint32_t FlushEngine::initFlush(const IFlushHandler::SP &handler, const IFlushTarget::SP &target) { uint32_t taskId(0); { std::lock_guard<std::mutex> guard(_lock); taskId = _taskId++; vespalib::string name(FlushContext::createName(*handler, *target)); FlushInfo flush(taskId, target, name); _flushing[taskId] = flush; } LOG(debug, "FlushEngine::initFlush(handler='%s', target='%s') => taskId='%d'", handler->getName().c_str(), target->getName().c_str(), taskId); return taskId; }
void printAllTasks(void) { Task *task; for (task = all_tasks; task != NULL; task = task->all_next) { debugBelch("task %p is %s, ", taskId(task), task->stopped ? "stopped" : "alive"); if (!task->stopped) { if (task->cap) { debugBelch("on capability %d, ", task->cap->no); } if (task->incall->tso) { debugBelch("bound to thread %lu", (unsigned long)task->incall->tso->id); } else { debugBelch("worker"); } } debugBelch("\n"); } }
QDomElement Event::toXml( QDomDocument document ) const { QDomElement element = document.createElement( EventElement ); element.setAttribute( EventIdAttribute, QString().setNum( id() ) ); element.setAttribute( EventInstallationIdAttribute, QString().setNum( installationId() ) ); element.setAttribute( EventTaskIdAttribute, QString().setNum( taskId() ) ); element.setAttribute( EventUserIdAttribute, QString().setNum( userId() ) ); element.setAttribute( EventReportIdAttribute, QString().setNum( reportId() ) ); if ( m_start.isValid() ) { element.setAttribute( EventStartAttribute, m_start.toString( Qt::ISODate ) ); } if ( m_end.isValid() ) { element.setAttribute( EventEndAttribute, m_end.toString( Qt::ISODate ) ); } if ( !comment().isEmpty() ) { QDomText commentText = document.createTextNode( comment() ); element.appendChild( commentText ); } return element; }
TaskAttribute *TaskAttribute::clone() const { TaskAttribute *attr = new TaskAttribute(); attr->setTaskId(taskId()); return attr; }