#pragma once #include #include #include #include #include "Export.h" #include "WebFileInfo.h" using std::chrono::operator""s; using std::chrono::operator""min; class UNSWSC_DLL_EXPORT TempFileManager { private: class Impl; std::unique_ptr pimpl; public: TempFileManager() noexcept; ~TempFileManager() noexcept; // 禁止拷贝与移动 TempFileManager(const TempFileManager&) = delete; TempFileManager& operator=(const TempFileManager&) = delete; TempFileManager(TempFileManager&&) = delete; TempFileManager& operator=(TempFileManager&&) = delete; // 基础业务接口(保持不变) bool SetBaseDirectory(std::string dir) noexcept; bool RegisterFile(const WebFileInfo& info, std::chrono::seconds timeout, std::chrono::seconds max_proc_timeout = std::chrono::seconds(0)) noexcept; bool InvalidateFile(const WebFileInfo& info); //For SFR_FileMap bool InvalidateFile(const std::map& info); bool CopyFileTo(const std::string& storage_name, const std::string& dest_absolute_path) noexcept; bool CutFileTo(const std::string& storage_name, const std::string& dest_absolute_path) noexcept; bool RenameFile(const std::string& old_storage_name, const std::string& new_storage_name) noexcept; bool DeleteFile(const std::string& storage_name) noexcept; bool ActiveFile(const std::string& storage_name) noexcept; bool DeactiveFile(const std::string& storage_name) noexcept; bool SetPermanent(const std::string& storage_name, bool permanent) noexcept; bool FileExists(const std::string& storage_name) const noexcept; bool GetFileInfo(const std::string& storage_name, WebFileInfo& out_info) const noexcept; size_t GetFileCount() const noexcept; // 获取当前所有管理中的文件信息快照(线程安全,绝不抛出异常) std::vector GetAllFileInfos() const noexcept; };