添加文件缓存
This commit is contained in:
1 parent
e8b91b1a59
commit
133424f5f8
7 files changed
+169
-34
No files matched your search
@@ -7,8 +7,8 @@
|
||||
#include <string>
|
||||
#include <winfsp/winfsp.h>
|
||||
|
||||
#include "../api/seafile_api.hpp"
|
||||
#include "../api/token_type.hpp"
|
||||
#include "seafile/api/seafile_api.hpp"
|
||||
#include "seafile/api/token_type.hpp"
|
||||
#include "seafile/api/cached_seafile_api.hpp"
|
||||
#include "seafile/cache/cache.hpp"
|
||||
|
||||
|
||||
@@ -9,38 +9,43 @@
|
||||
|
||||
#include "storage/repo_entry.hpp"
|
||||
|
||||
namespace seafile::fs {
|
||||
|
||||
|
||||
class SeafileStore final {
|
||||
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 std::string& db_path, const std::string& server, const std::string& user,
|
||||
const std::string& password);
|
||||
|
||||
SeafileStore(const SeafileStore &) = default;
|
||||
SeafileStore(const SeafileStore&) = delete;
|
||||
|
||||
tl::expected<void,api::SeafileException> auth();
|
||||
tl::expected<void, api::SeafileException> auth();
|
||||
|
||||
[[nodiscard]] tl::expected<std::string, api::SeafileException> defaultRepoId() const;
|
||||
|
||||
///初始化数据库信息
|
||||
[[nodiscard]] tl::expected<void, api::SeafileException> init() const;
|
||||
|
||||
/// 检查是否已经更新到最新
|
||||
/// @return true 已经最新,false 需要更新
|
||||
tl::expected<bool, api::SeafileException> checkIsUpdated(const std::string& repo_id);
|
||||
|
||||
/// 检查是否需要更新元素据,如果需要同步则自动同步
|
||||
tl::expected<void, api::SeafileException> checkAndSync(const std::string& repo_id,);
|
||||
tl::expected<void, api::SeafileException> checkAndSync(const std::string& repo_id);
|
||||
|
||||
/// 同步元数据
|
||||
tl::expected<void, api::SeafileException> sync(const std::string& repo_id);
|
||||
[[nodiscard]] tl::expected<void, api::SeafileException> sync(const std::string& repo_id) const;
|
||||
|
||||
/// 获取路径信息
|
||||
/// @param path 路径
|
||||
/// @return 路径信息
|
||||
tl::expected<storage::RepoEntry, api::SeafileException> findRepoEntry(const std::string& repo_id, const std::string &path);
|
||||
tl::expected<storage::RepoEntry, api::SeafileException> findRepoEntry(
|
||||
const std::string& repo_id, const std::string& path);
|
||||
|
||||
private:
|
||||
struct Database;
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
#include "seafile/api/repo_entry.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace seafile::fs::storage {
|
||||
struct RepoEntry final {
|
||||
namespace seafile::fs::storage
|
||||
{
|
||||
struct RepoEntry final
|
||||
{
|
||||
///repo id
|
||||
std::string repo_id;
|
||||
|
||||
@@ -56,6 +58,9 @@ namespace seafile::fs::storage {
|
||||
|
||||
/// Whether the entry is starred by the current user.
|
||||
std::optional<bool> starred{};
|
||||
|
||||
static auto from_api_model(const std::string& repo_id, const std::string& path,
|
||||
const api::RepoEntry& entry) -> RepoEntry;
|
||||
};
|
||||
}
|
||||
#endif //SEADISK_STORAGE_REPO_ENTRY_HPP
|
||||
Reference in new issue
Block a user