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

Method CreateLoadTableRemoteTask

src/nameserver/name_server_impl.cc:6998–7021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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,
7000 uint32_t pid, uint64_t op_index,
7001 ::fedb::api::OPType op_type) {
7002 std::shared_ptr<fedb::nameserver::ClusterInfo> cluster = GetHealthCluster(alias);
7003 if (!cluster) {
7004 PDLOG(WARNING, "replica[%s] not available op_index[%lu]", alias.c_str(), op_index);
7005 return std::shared_ptr<Task>();
7006 }
7007 std::string cluster_endpoint =
7008 std::atomic_load_explicit(&cluster->client_, std::memory_order_relaxed)->GetEndpoint();
7009 std::shared_ptr<Task> task = std::make_shared<Task>(cluster_endpoint, std::make_shared<::fedb::api::TaskInfo>());
7010 task->task_info_->set_op_id(op_index);
7011 task->task_info_->set_op_type(op_type);
7012 task->task_info_->set_task_type(::fedb::api::TaskType::kLoadTable);
7013 task->task_info_->set_status(::fedb::api::TaskStatus::kInited);
7014 task->task_info_->set_endpoint(cluster_endpoint);
7015
7016 boost::function<bool()> fun =
7017 boost::bind(&NsClient::LoadTable, std::atomic_load_explicit(&cluster->client_, std::memory_order_relaxed), name,
7018 db, endpoint, pid, zone_info_, *(task->task_info_));
7019 task->fun_ = boost::bind(&NameServerImpl::WrapTaskFun, this, fun, task->task_info_);
7020 return task;
7021}
7022
7023std::shared_ptr<Task> NameServerImpl::CreateAddReplicaRemoteTask(const std::string& endpoint, uint64_t op_index,
7024 ::fedb::api::OPType op_type, uint32_t tid,

Callers

nothing calls this directly

Calls 1

GetEndpointMethod · 0.45

Tested by

no test coverage detected