添加文件缓存

This commit is contained in:
asypost committed 2026-07-14 21:28:08 +08:00
1 parent fb63205a70
commit 95b68b9542
18 files changed
+481 -107

No files matched your search

+12 -4
View File
@@ -9,24 +9,32 @@
#include "../api/seafile_api.hpp"
#include "../api/token_type.hpp"
#include "seafile/api/cached_seafile_api.hpp"
#include "seafile/cache/cache.hpp"
namespace seafile::fs
{
class SeafileFileSystem final
{
using SeafileException = api::SeafileException;
using TokenType = api::TokenType;
using ISeaFileApi = api::ISeaFileApi;
using RepoEntry = api::RepoEntry;
std::string repo_id;
std::string token;
TokenType token_type = TokenType::TOKEN;
SeaFileApi api;
std::shared_ptr<ISeaFileApi> api;
std::wstring volume_label;
cache::Cache<std::string,std::vector<RepoEntry>> repo_dir_cache{};
public:
explicit SeafileFileSystem(const std::string& server,
const std::wstring& volume_label) : api(server), volume_label(volume_label)
const std::wstring& volume_label) : volume_label(volume_label)
{
this->api = std::make_shared<api::CachedSeafileApi>(
std::make_shared<api::SeaFileApi>(server)
);
}
tl::expected<void, SeafileException> initialize(const std::string& username, const std::string& password);