MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / CreateLoadTableTask

Method CreateLoadTableTask

src/nameserver/name_server_impl.cc:6967–6996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6965}
6966
6967std::shared_ptr<Task> NameServerImpl::CreateLoadTableTask(const std::string& endpoint, uint64_t op_index,
6968 ::fedb::api::OPType op_type, const std::string& name,
6969 uint32_t tid, uint32_t pid, uint32_t seg_cnt,
6970 bool is_leader) {
6971 std::shared_ptr<Task> task = std::make_shared<Task>(endpoint, std::make_shared<::fedb::api::TaskInfo>());
6972 auto it = tablets_.find(endpoint);
6973 if (it == tablets_.end() || it->second->state_ != ::fedb::api::TabletState::kTabletHealthy) {
6974 return std::shared_ptr<Task>();
6975 }
6976 task->task_info_->set_op_id(op_index);
6977 task->task_info_->set_op_type(op_type);
6978 task->task_info_->set_task_type(::fedb::api::TaskType::kLoadTable);
6979 task->task_info_->set_status(::fedb::api::TaskStatus::kInited);
6980 task->task_info_->set_endpoint(endpoint);
6981
6982 ::fedb::api::TableMeta table_meta;
6983 table_meta.set_name(name);
6984 table_meta.set_tid(tid);
6985 table_meta.set_pid(pid);
6986 table_meta.set_seg_cnt(seg_cnt);
6987 if (is_leader) {
6988 table_meta.set_mode(::fedb::api::TableMode::kTableLeader);
6989 } else {
6990 table_meta.set_mode(::fedb::api::TableMode::kTableFollower);
6991 }
6992 boost::function<bool()> fun =
6993 boost::bind(&TabletClient::LoadTable, it->second->client_, table_meta, task->task_info_);
6994 task->fun_ = boost::bind(&NameServerImpl::WrapTaskFun, this, fun, task->task_info_);
6995 return task;
6996}
6997
6998std::shared_ptr<Task> NameServerImpl::CreateLoadTableRemoteTask(const std::string& alias, const std::string& name,
6999 const std::string& db, const std::string& endpoint,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected