1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

added test to lookup file

This commit is contained in:
Falk Werner
2020-06-14 10:39:33 +02:00
parent edcad5dc4c
commit 28f3f4ca47
5 changed files with 217 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
#include "webfuse/utils/adapter_client.hpp"
#include "webfuse/utils/tempdir.hpp"
#include <thread>
#include <mutex>
#include <queue>
namespace
{
@@ -31,6 +31,7 @@ public:
: client(wf_client_create(callback, user_data))
, url_(url)
, command(Command::run)
, tempdir("webfuse_adpter_client")
{
thread = std::thread(&Run, this);
}
@@ -52,6 +53,11 @@ public:
wf_client_interrupt(client);
}
std::string GetDir()
{
return tempdir.path();
}
private:
static void Run(Private * self)
{
@@ -80,7 +86,7 @@ private:
wf_client_authenticate(self->client);
break;
case Command::add_filesystem:
wf_client_add_filesystem(self->client, "/tmp", "test");
wf_client_add_filesystem(self->client, self->tempdir.path(), "test");
break;
case Command::shutdown:
// fall-through
@@ -95,6 +101,7 @@ private:
wf_client * client;
std::string url_;
Command command;
TempDir tempdir;
std::thread thread;
std::mutex mutex;
};
@@ -133,4 +140,10 @@ void AdapterClient::AddFileSystem()
d->ApplyCommand(Command::add_filesystem);
}
std::string AdapterClient::GetDir() const
{
return d->GetDir();
}
}

View File

@@ -21,6 +21,7 @@ public:
void Disconnect();
void Authenticate();
void AddFileSystem();
std::string GetDir() const;
private:
class Private;
Private * d;