[ui] Implement provider test button #49
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
This commit is contained in:
parent
de5eb1005c
commit
22eb7a44b4
@ -42,6 +42,8 @@ private:
|
|||||||
remote::group_id gid_ = 0;
|
remote::group_id gid_ = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
[[nodiscard]] auto check() -> packet::error_type;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_access(const char *path, const std::int32_t &mask)
|
[[nodiscard]] auto fuse_access(const char *path, const std::int32_t &mask)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
@ -51,9 +53,9 @@ public:
|
|||||||
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||||
fuse_chown(const char *path, const remote::user_id &uid,
|
const remote::group_id &gid)
|
||||||
const remote::group_id &gid) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
||||||
|
|
||||||
@ -67,21 +69,23 @@ public:
|
|||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_fsetattr_x(
|
[[nodiscard]] auto fuse_fsetattr_x(const char *path,
|
||||||
const char *path, const remote::setattr_x &attr,
|
const remote::setattr_x &attr,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||||
fuse_fsync(const char *path, const std::int32_t &datasync,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_ftruncate(
|
[[nodiscard]] auto fuse_ftruncate(const char *path,
|
||||||
const char *path, const remote::file_offset &size,
|
const remote::file_offset &size,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_getattr(const char *path, remote::stat &st,
|
||||||
fuse_getattr(const char *path, remote::stat &st,
|
bool &directory)
|
||||||
bool &directory) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
||||||
*name, char *value, const remote::file_size &size) override ;
|
*name, char *value, const remote::file_size &size) override ;
|
||||||
@ -90,9 +94,10 @@ public:
|
|||||||
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
||||||
override ;*/
|
override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_getxtimes(const char *path,
|
||||||
fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
remote::file_time &bkuptime,
|
||||||
remote::file_time &crtime) -> packet::error_type override;
|
remote::file_time &crtime)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
||||||
|
|
||||||
@ -107,25 +112,27 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_create(const char *path, const remote::file_mode &mode,
|
fuse_create(const char *path, const remote::file_mode &mode,
|
||||||
const remote::open_flags &flags,
|
const remote::open_flags &flags, remote::file_handle &handle)
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_open(const char *path,
|
||||||
fuse_open(const char *path, const remote::open_flags &flags,
|
const remote::open_flags &flags,
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_read(const char *path, char *buffer,
|
||||||
fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
const remote::file_size &read_size,
|
||||||
const remote::file_offset &read_offset,
|
const remote::file_offset &read_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_rename(const char *from,
|
[[nodiscard]] auto fuse_rename(const char *from, const char *to)
|
||||||
const char *to) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||||
const remote::file_handle &handle,
|
const remote::file_handle &handle, std::string &item_path)
|
||||||
std::string &item_path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_release(const char *path,
|
[[nodiscard]] auto fuse_release(const char *path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
@ -139,8 +146,8 @@ public:
|
|||||||
* char *name) override
|
* char *name) override
|
||||||
* ;*/
|
* ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_rmdir(const char *path)
|
||||||
fuse_rmdir(const char *path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
@ -157,8 +164,8 @@ public:
|
|||||||
const remote::file_time &crtime)
|
const remote::file_time &crtime)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_setvolname(const char *volname)
|
||||||
fuse_setvolname(const char *volname) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] /*packet::error_type fuse_setxattr(const char *path, const char
|
[[nodiscard]] /*packet::error_type fuse_setxattr(const char *path, const char
|
||||||
*name, const char *value, const remote::file_size &size, const std::int32_t
|
*name, const char *value, const remote::file_size &size, const std::int32_t
|
||||||
@ -169,45 +176,48 @@ public:
|
|||||||
std::int32_t &flags, std::uint32_t position) override ;*/
|
std::int32_t &flags, std::uint32_t position) override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_statfs(const char *path, std::uint64_t frsize,
|
fuse_statfs(const char *path, std::uint64_t frsize, remote::statfs &st)
|
||||||
remote::statfs &st) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||||
fuse_statfs_x(const char *path, std::uint64_t bsize,
|
remote::statfs_x &st)
|
||||||
remote::statfs_x &st) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_truncate(const char *path,
|
||||||
fuse_truncate(const char *path,
|
const remote::file_offset &size)
|
||||||
const remote::file_offset &size) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_unlink(const char *path)
|
||||||
fuse_unlink(const char *path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||||
fuse_utimens(const char *path, const remote::file_time *tv, std::uint64_t op0,
|
std::uint64_t op0, std::uint64_t op1)
|
||||||
std::uint64_t op1) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_write(const char *path, const char *buffer,
|
||||||
fuse_write(const char *path, const char *buffer,
|
const remote::file_size &write_size,
|
||||||
const remote::file_size &write_size,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_write_base64(
|
[[nodiscard]] auto fuse_write_base64(const char *path, const char *buffer,
|
||||||
const char *path, const char *buffer, const remote::file_size &write_size,
|
const remote::file_size &write_size,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto json_create_directory_snapshot(
|
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
|
||||||
const std::string &path, json &json_data) -> packet::error_type override;
|
json &json_data)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto json_read_directory_snapshot(
|
[[nodiscard]] auto json_read_directory_snapshot(
|
||||||
const std::string &path, const remote::file_handle &handle,
|
const std::string &path, const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto json_release_directory_snapshot(
|
[[nodiscard]] auto
|
||||||
const std::string &path,
|
json_release_directory_snapshot(const std::string &path,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
void set_fuse_uid_gid(const remote::user_id &uid,
|
void set_fuse_uid_gid(const remote::user_id &uid,
|
||||||
const remote::group_id &gid) override;
|
const remote::group_id &gid) override;
|
||||||
|
@ -103,6 +103,13 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const std::unordered_map<std::string, handler_callback> handler_lookup_ = {
|
const std::unordered_map<std::string, handler_callback> handler_lookup_ = {
|
||||||
|
{
|
||||||
|
"::check",
|
||||||
|
[this](auto && /* service_flags */, auto && /* client_id */,
|
||||||
|
auto && /* thread_id */, auto && /* method */,
|
||||||
|
auto && /* request */,
|
||||||
|
auto && /* response */) -> auto { return 0; },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"::fuse_access",
|
"::fuse_access",
|
||||||
[this](auto && /* service_flags */, auto && /* client_id */,
|
[this](auto && /* service_flags */, auto && /* client_id */,
|
||||||
|
@ -48,6 +48,8 @@ private:
|
|||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
[[nodiscard]] auto check() -> packet::error_type;
|
||||||
|
|
||||||
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
|
@ -29,6 +29,14 @@ namespace repertory::remote_fuse {
|
|||||||
remote_client::remote_client(const app_config &config)
|
remote_client::remote_client(const app_config &config)
|
||||||
: config_(config), packet_client_(config.get_remote_config()) {}
|
: config_(config), packet_client_(config.get_remote_config()) {}
|
||||||
|
|
||||||
|
auto remote_client::check() -> packet::error_type {
|
||||||
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
|
packet request;
|
||||||
|
std::uint32_t service_flags{};
|
||||||
|
return packet_client_.send(function_name, request, service_flags);
|
||||||
|
}
|
||||||
|
|
||||||
auto remote_client::fuse_access(const char *path, const std::int32_t &mask)
|
auto remote_client::fuse_access(const char *path, const std::int32_t &mask)
|
||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
@ -33,6 +33,14 @@ namespace repertory::remote_winfsp {
|
|||||||
remote_client::remote_client(const app_config &config)
|
remote_client::remote_client(const app_config &config)
|
||||||
: config_(config), packet_client_(config.get_remote_config()) {}
|
: config_(config), packet_client_(config.get_remote_config()) {}
|
||||||
|
|
||||||
|
auto remote_client::check() -> packet::error_type {
|
||||||
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
|
packet request;
|
||||||
|
std::uint32_t service_flags{};
|
||||||
|
return packet_client_.send(function_name, request, service_flags);
|
||||||
|
}
|
||||||
|
|
||||||
auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
@ -30,12 +30,13 @@ test(std::vector<const char *> /* args */, const std::string &data_directory,
|
|||||||
const provider_type &prov, const std::string & /*unique_id*/,
|
const provider_type &prov, const std::string & /*unique_id*/,
|
||||||
std::string /*user*/, std::string /*password*/) -> exit_code {
|
std::string /*user*/, std::string /*password*/) -> exit_code {
|
||||||
app_config config(prov, data_directory);
|
app_config config(prov, data_directory);
|
||||||
if (prov == provider_type::remote) {
|
|
||||||
return exit_code::provider_offline;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto provider{create_provider(prov, config)};
|
auto is_online{
|
||||||
auto is_online{provider->is_online()};
|
(prov == provider_type::remote)
|
||||||
|
? remote_client(config).check() == 0
|
||||||
|
: create_provider(prov, config)->is_online(),
|
||||||
|
};
|
||||||
|
|
||||||
fmt::println("{}\nProvider is {}!", utils::string::from_bool(is_online),
|
fmt::println("{}\nProvider is {}!", utils::string::from_bool(is_online),
|
||||||
is_online ? "online" : "offline");
|
is_online ? "online" : "offline");
|
||||||
return is_online ? exit_code::success : exit_code::provider_offline;
|
return is_online ? exit_code::success : exit_code::provider_offline;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user