// // Created by Shell on 2026/7/16. // #ifndef SEADISK_SEAFILE_STORE_HPP #define SEADISK_SEAFILE_STORE_HPP #include "seafile/api/seafile_api.hpp" #include #include "storage/repo_entry.hpp" namespace seafile::fs { class SeafileStore final { public: /// construction /// @param db_path database file path /// @param server the server url of seafile /// @param user user /// @param password password SeafileStore(const std::string& db_path, const std::string& server, const std::string& user, const std::string& password); SeafileStore(const SeafileStore&) = delete; tl::expected auth(); [[nodiscard]] tl::expected defaultRepoId() const; ///初始化数据库信息 [[nodiscard]] tl::expected init() const; /// 检查是否已经更新到最新 /// @return true 已经最新,false 需要更新 tl::expected checkIsUpdated(const std::string& repo_id); /// 检查是否需要更新元素据,如果需要同步则自动同步 tl::expected checkAndSync(const std::string& repo_id); /// 同步元数据 [[nodiscard]] tl::expected sync(const std::string& repo_id) const; /// 获取路径信息 /// @param path 路径 /// @return 路径信息 tl::expected findRepoEntry( const std::string& repo_id, const std::string& path); private: struct Database; std::unique_ptr database; std::string api_server; std::string user; std::string password; std::string token; api::TokenType token_type = api::TokenType::TOKEN; api::SeaFileApi api; }; } #endif //SEADISK_SEAFILE_STORE_HPP