本文整理汇总了C++中TaskInfo::set_token方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskInfo::set_token方法的具体用法?C++ TaskInfo::set_token怎么用?C++ TaskInfo::set_token使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskInfo
的用法示例。
在下文中一共展示了TaskInfo::set_token方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insert_task
// add a new task
int TaskManager::insert_task(const TabletLocation & location, TaskInfo & task)
{
int ret = OB_SUCCESS;
task.set_location(location);
task.set_token(task_token_);
int64_t timestamp = tbsys::CTimeUtil::getTime();
task.set_timestamp(timestamp);
std::map<ObServer, int64_t>::const_iterator it;
tbsys::CThreadGuard lock(&lock_);
task.set_id(++task_id_alloc_);
++total_task_count_;
wait_queue_.insert(pair<uint64_t, TaskInfo>(task.get_id(), task));
for (int64_t i = 0; i < location.size(); ++i)
{
// TODO server counter for select task
it = server_manager_.find(location[i].chunkserver_);
if (it != server_manager_.end())
{
server_manager_[location[i].chunkserver_] = it->second + 1;
}
else
{
server_manager_.insert(pair<ObServer, int64_t>(location[i].chunkserver_, 1));
}
}
TBSYS_LOG(DEBUG, "insert task succ:id[%lu], count[%lu]", task_id_alloc_, total_task_count_);
return ret;
}
示例2: insert_task
// add a new task
int TaskManager::insert_task(const TabletLocation & location, TaskInfo & task)
{
int ret = OB_SUCCESS;
task.set_location(location);
task.set_token(task_token_);
int64_t timestamp = tbsys::CTimeUtil::getTime();
task.set_timestamp(timestamp);
std::map<ObServer, int64_t>::const_iterator it;
tbsys::CThreadGuard lock(&lock_);
task.set_id(++task_id_alloc_);
++total_task_count_;
wait_queue_.insert(pair<uint64_t, TaskInfo>(task.get_id(), task));
for (int64_t i = 0; i < location.size(); ++i)
{
// TODO server counter for select task
it = server_manager_.find(location[i].chunkserver_);
if (it != server_manager_.end())
{
server_manager_[location[i].chunkserver_] = it->second + 1;
}
else
{
server_manager_.insert(pair<ObServer, int64_t>(location[i].chunkserver_, 1));
}
}
TBSYS_LOG(DEBUG, "insert task succ:id[%lu], table_name[%.*s], range[%s], count[%lu]", task_id_alloc_,
task.get_param().get_table_name().length(), task.get_param().get_table_name().ptr(),
to_cstring(*task.get_param().get_range()), total_task_count_);
#if false
std::map<uint64_t, TaskInfo>::iterator temp_it;
for (temp_it = wait_queue_.begin(); temp_it != wait_queue_.end(); ++temp_it)
{
TBSYS_LOG(TRACE, "dump task range:task[%ld], range[%p:%s], key_obj[%p:%p]", temp_it->first,
temp_it->second.get_param().get_range(), to_cstring(*temp_it->second.get_param().get_range()),
temp_it->second.get_param().get_range()->start_key_.ptr(), temp_it->second.get_param().get_range()->end_key_.ptr());
}
#endif
return ret;
}