Teaspeak-Server/file/local_server/LocalFileProvider.h

52 lines
1.7 KiB
C
Raw Normal View History

2020-05-07 15:28:15 -04:00
#pragma once
#include <files/FileServer.h>
#include <deque>
#include <utility>
#include <thread>
#include <shared_mutex>
#include <sys/socket.h>
#include <pipes/ws.h>
#include <pipes/ssl.h>
#include <misc/net.h>
2020-05-13 05:32:08 -04:00
#include <misc/spin_mutex.h>
2020-05-07 15:28:15 -04:00
#include <random>
#include <misc/memtracker.h>
2020-05-13 05:32:08 -04:00
#include "./NetTools.h"
2020-05-07 15:28:15 -04:00
namespace ts::server::file {
namespace filesystem { class LocalFileSystem; }
namespace transfer { class LocalFileTransfer; }
2020-05-07 15:28:15 -04:00
2020-05-13 05:32:08 -04:00
class LocalVirtualFileServer : public VirtualFileServer {
public:
explicit LocalVirtualFileServer(ServerId server_id, std::string unique_id) : VirtualFileServer{server_id, std::move(unique_id)} {}
void max_networking_upload_bandwidth(int64_t value) override;
void max_networking_download_bandwidth(int64_t value) override;
networking::NetworkThrottle upload_throttle{};
networking::NetworkThrottle download_throttle{};
};
2020-05-07 15:28:15 -04:00
class LocalFileProvider : public AbstractFileServer {
public:
LocalFileProvider();
virtual ~LocalFileProvider();
[[nodiscard]] bool initialize(std::string& /* error */);
2020-05-07 15:28:15 -04:00
void finalize();
2020-05-13 05:32:08 -04:00
[[nodiscard]] std::string file_base_path() const override;
2020-05-07 15:28:15 -04:00
filesystem::AbstractProvider &file_system() override;
transfer::AbstractProvider &file_transfer() override;
2020-05-13 05:32:08 -04:00
std::shared_ptr<VirtualFileServer> register_server(ServerId /* server id */) override;
void unregister_server(ServerId /* server id */) override;
2020-05-07 15:28:15 -04:00
private:
filesystem::LocalFileSystem* file_system_;
transfer::LocalFileTransfer* file_transfer_;
2020-05-07 15:28:15 -04:00
};
}