milvus/cpp/src/scheduler/task/TaskConvert.cpp
wxyu 4de6f675ec MS-354 Add task class and interface in scheduler
Former-commit-id: 0a61d095db7144006b80bc0824886e62be71a5d5
2019-08-14 20:09:00 +08:00

39 lines
1.1 KiB
C++

/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#include "TaskConvert.h"
namespace zilliz {
namespace milvus {
namespace engine {
TaskPtr
TaskConvert(const ScheduleTaskPtr &schedule_task) {
switch (schedule_task->type()) {
case ScheduleTaskType::kIndexLoad: {
auto load_task = std::static_pointer_cast<IndexLoadTask>(schedule_task);
auto task = std::make_shared<XSearchTask>();
task->file_ = load_task->file_;
task->search_contexts_ = load_task->search_contexts_;
task->task_ = schedule_task;
return task;
}
case ScheduleTaskType::kDelete: {
// TODO: convert to delete task
return nullptr;
}
default: {
// TODO: unexpected !!!
return nullptr;
}
}
}
}
}
}