mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
/*******************************************************************************
|
|
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
|
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
* Proprietary and confidential.
|
|
******************************************************************************/
|
|
#pragma once
|
|
|
|
#include "SearchContext.h"
|
|
#include "IndexLoaderQueue.h"
|
|
#include "SearchTaskQueue.h"
|
|
|
|
namespace zilliz {
|
|
namespace milvus {
|
|
namespace engine {
|
|
|
|
class SearchScheduler {
|
|
private:
|
|
SearchScheduler();
|
|
virtual ~SearchScheduler();
|
|
|
|
public:
|
|
static SearchScheduler& GetInstance();
|
|
|
|
bool ScheduleSearchTask(SearchContextPtr& search_context);
|
|
|
|
private:
|
|
bool Start();
|
|
bool Stop();
|
|
|
|
bool IndexLoadWorker();
|
|
bool SearchWorker();
|
|
|
|
private:
|
|
std::shared_ptr<std::thread> index_load_thread_;
|
|
std::shared_ptr<std::thread> search_thread_;
|
|
|
|
IndexLoaderQueue index_load_queue_;
|
|
SearchTaskQueue search_queue_;
|
|
|
|
bool stopped_ = true;
|
|
};
|
|
|
|
|
|
}
|
|
}
|
|
}
|