recall stat
This commit is contained in:
@@ -68,6 +68,12 @@ enum class ActionResult {
|
||||
};
|
||||
|
||||
// ====== ★修改:扩展 RecallFile,支持“多目录 + 文件筛选 + 串行下载”的状态机 ======
|
||||
enum class RecallFileType {
|
||||
NONE = 0,
|
||||
STEADY_FILE, // 稳态文件
|
||||
VOLTAGE_FILE // 暂态直下文件
|
||||
};
|
||||
|
||||
class RecallFile
|
||||
{
|
||||
public:
|
||||
@@ -75,18 +81,31 @@ public:
|
||||
int recall_status; // 补招状态 0-未补招 1-补招中 2-补招完成 3-补招失败
|
||||
std::string StartTime; // 数据补招起始时间(yyyy-MM-dd HH:mm:ss)
|
||||
std::string EndTime; // 数据补招结束时间(yyyy-MM-dd HH:mm:ss)
|
||||
|
||||
// ===== 业务类型 =====
|
||||
// STEADY:稳态文件补招
|
||||
// VOLTAGE:暂态事件补招
|
||||
std::string STEADY; // 补招历史统计数据标识 0-不补招;1-补招
|
||||
std::string VOLTAGE; // 补招暂态事件标识 0-不补招;1-补招
|
||||
|
||||
// ===== 文件下载类型 =====
|
||||
RecallFileType file_type = RecallFileType::NONE;
|
||||
|
||||
//暂态文件用
|
||||
bool direct_mode = false; // 直下文件开关:true 表示不按时间窗,仅按目标文件名
|
||||
std::string target_filetimes; // 直下文件匹配时间点(yyyyMMdd_HHmmss),仅 direct_mode=true 时有效
|
||||
std::string target_filetimes; // 直下文件匹配时间点(yyyyMMdd_HHmmss)
|
||||
|
||||
// ★新增:按“目录名 -> 文件名列表”的映射;由“其他线程”在目录请求成功后回填
|
||||
std::map<std::string, std::vector<tag_dir_info>> dir_files;
|
||||
|
||||
// ★新增:候选目录(可扩展)
|
||||
std::vector<std::string> dir_candidates{
|
||||
std::vector<std::string> steady_dir_candidates{
|
||||
"/pqdif", // 默认版本 / 新疆
|
||||
"/pqdif/%DAY%", // 上海:日期子目录
|
||||
"/pqdif/%DESC%/%DAY%", // 上海:pqdif_dir_cfg 或描述目录 + 日期
|
||||
"/pqdif/Line%SEQ%", // 云南
|
||||
"/historyFile/%DESC%" // 广东
|
||||
};
|
||||
|
||||
std::vector<std::string> voltage_dir_candidates{
|
||||
"/cf/COMTRADE",
|
||||
"/bd0/COMTRADE",
|
||||
"/sd0/COMTRADE",
|
||||
@@ -102,6 +121,9 @@ public:
|
||||
ActionResult list_result = ActionResult::PENDING; // 当前目录的列举结果
|
||||
ActionResult download_result = ActionResult::PENDING; // 当前文件的下载结果
|
||||
|
||||
// 稳态文件用:一个 guid 下的多个补招时间段
|
||||
std::vector<std::pair<long long, long long>> recall_ranges;
|
||||
|
||||
// ★新增:下载队列(已筛选出在时间窗内的文件,含完整路径)
|
||||
std::list<std::string> download_queue; //一个时间可能对应多个文件
|
||||
std::string downloading_file; // 当前正在下载的文件(完整路径)
|
||||
@@ -109,8 +131,22 @@ public:
|
||||
std::unordered_set<std::string> required_files; // 本次应当下载成功的文件全集
|
||||
std::unordered_set<std::string> file_success; // 已下载成功的文件集合
|
||||
|
||||
// 是否稳态文件任务
|
||||
bool is_steady_file() const {
|
||||
return file_type == RecallFileType::STEADY_FILE;
|
||||
}
|
||||
|
||||
// 是否暂态直下文件任务
|
||||
bool is_voltage_file() const {
|
||||
return file_type == RecallFileType::VOLTAGE_FILE;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& active_dirs() const {
|
||||
return is_steady_file() ? steady_dir_candidates : voltage_dir_candidates;
|
||||
}
|
||||
|
||||
// ★新增:一个便捷复位
|
||||
void reset_runtime(bool keep_direct = false)
|
||||
void reset_runtime(bool keep_target_filetimes = false)
|
||||
{
|
||||
phase = RecallPhase::IDLE;
|
||||
cur_dir_index = 0;
|
||||
@@ -124,9 +160,10 @@ public:
|
||||
required_files.clear();
|
||||
file_success.clear();
|
||||
|
||||
// 注意:file_type 不属于运行态,不能清除,因为它决定了本次补招的业务类型(稳态/暂态),而这个业务类型在整个补招过程中是固定的,不应当被运行态重置影响
|
||||
|
||||
// ★新增:按需保留直下文件开关和目标名
|
||||
if (!keep_direct) {
|
||||
direct_mode = false;
|
||||
if (!keep_target_filetimes) {
|
||||
target_filetimes.clear(); // ▲列表清空
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user