本文整理汇总了C++中FileID::set_id方法的典型用法代码示例。如果您正苦于以下问题:C++ FileID::set_id方法的具体用法?C++ FileID::set_id怎么用?C++ FileID::set_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileID
的用法示例。
在下文中一共展示了FileID::set_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reqFileData
rc_t LogCollectorImpl::reqFileData(file_id_t file_id, file_size_t pos, uint8_t* data, uint32_t len) {
Request* pRequest = getRequest(0);
if (NULL == pRequest) { return RC_S_NULL_VALUE; }
// FileData
FileDataRequest* pFileDataRequest = pRequest->GetFileDataRequest();
if (NULL == pFileDataRequest) { return RC_E_NOMEM; }
// send only
if (IFileNode::INVALID_FILE_ID == file_id || NULL == data || 0 == len) {
if (0 == pFileDataRequest->filedata_size() || RC_S_OK != pRequest->SerializeRequest()) { return RC_S_FAILED; }
return m_autoRelINetHandler->Send(this, pRequest->GetRequestData(), pRequest->GetRequestSize());
}
//
// deflate
ASSERT(IFileCollector::kMAX_READ_SIZE >= len);
size_t encode_size = m_autoRelMemDefalte->len();
if (RC_S_OK != m_autoRelICoderDefalte->encode(m_autoRelMemDefalte->data(), &encode_size, data, len)) {
LOG(ILogWriter::LV_WARN, "Deflate EnCode Failed, Org. Data Len=%u", len);
return RC_S_FAILED;
}
// is too big
if (INetHandler::kMAX_REQ_DATA_SIZE < encode_size) { return RC_E_ACCESS; }
if (INetHandler::kMAX_REQ_DATA_SIZE < pFileDataRequest->ByteSize() + encode_size) {
if (RC_S_OK != pRequest->SerializeRequest()) {
LOG(ILogWriter::LV_WARN, "FileData Packet EnCode Failed. len=%u(less)", pFileDataRequest->ByteSize() + encode_size);
return RC_S_FAILED;
}
if (RC_S_OK != m_autoRelINetHandler->Send(this, pRequest->GetRequestData(), pRequest->GetRequestSize())) { return RC_S_FAILED; }
pFileDataRequest = pRequest->GetFileDataRequest();
}
// make sure have FileDataRequest
if (NULL == pFileDataRequest) { return RC_E_NOMEM; }
FileDataRequest_FileData* pFileData = pFileDataRequest->add_filedata();
if (NULL == pFileData) { return RC_E_NOMEM; }
FileID* pFileID = pFileData->mutable_id();
if (NULL == pFileID) { return RC_E_NOMEM; }
pFileID->set_id(file_id);
pFileData->set_pos(pos);
pFileData->set_encode(FileDataRequest_FileData_EncodeType_DEFLATE);
pFileData->set_org_len(len);
pFileData->set_data(m_autoRelMemDefalte->data(), encode_size);
return RC_S_OK;
}
示例2: reqCheckSum
rc_t LogCollectorImpl::reqCheckSum(file_id_t file_id, uint32_t fb_cb_pos, uint32_t fb_cs_count) {
Request* pRequest = getRequest(0);
if (NULL == pRequest) { return RC_S_NULL_VALUE; }
// checksum
CheckSumRequest* pCheckSumRequest = pRequest->GetCheckSumRequest();
if (NULL == pCheckSumRequest) { return RC_E_NOMEM; }
FileID* pFileID = pCheckSumRequest->mutable_id();
if (NULL == pFileID) { return RC_E_NOMEM; }
pFileID->set_id(file_id);
pCheckSumRequest->set_fb_cs_pos(fb_cb_pos);
pCheckSumRequest->set_fb_cs_count(fb_cs_count);
if (RC_S_OK != pRequest->SerializeRequest()) { return RC_S_FAILED; }
return m_autoRelINetHandler->Send(this, pRequest->GetRequestData(), pRequest->GetRequestSize());
}