24#include <boost/asio.hpp>
30#include <unordered_set>
55using boost::asio::ip::tcp;
89 Server(boost::asio::io_context& io_context,
91 std::shared_ptr<RepositoryManager> repo_manager,
92 std::shared_ptr<ISubject> event_bus);
145 unsigned short getPort()
const;
179 void handleAccept(std::shared_ptr<tcp::socket> socket,
const boost::system::error_code& error);
190 void spawnClientHandler(std::shared_ptr<tcp::socket> socket);
201 void handleClient(std::shared_ptr<tcp::socket> socket);
214 std::string determineServiceType(std::shared_ptr<tcp::socket> socket);
229 bool executeProtocol(std::shared_ptr<tcp::socket> socket,
const std::string& service_type);
240 void removeClientConnection(std::shared_ptr<tcp::socket> socket);
251 void notifyServerEvent(
const std::string& message)
const;
262 void notifyClientConnection(
const std::string& message)
const;
273 void notifyServerError(
const std::string& message)
const;
283 boost::asio::io_context& io_context_;
292 tcp::acceptor acceptor_;
301 std::shared_ptr<RepositoryManager> repository_manager_;
310 std::shared_ptr<ISubject> event_bus_;
319 std::atomic<bool> is_running_;
328 std::unordered_set<std::shared_ptr<tcp::socket>> active_connections_;
337 mutable std::mutex connections_mutex_;
Defines the event structure used for the Observer pattern notifications.
Defines the interface for the Subject (Publisher) component of the Observer pattern.
Declaration of the RemoteProtocol class for handling remote communication protocol.
Declaration of the RepositoryManager class, managing all repository-level file operations.
~Server()
Destructor - stops the server and cleans up resources.
Definition Server.cxx:37
void stop()
Stops the server gracefully.
Definition Server.cxx:66
bool isRunning() const
Checks if the server is currently running.
Definition Server.cxx:99
bool start()
Starts the server and begins accepting connections.
Definition Server.cxx:43
size_t getActiveConnections() const
Gets the number of currently active client connections.
Definition Server.cxx:114
Server(boost::asio::io_context &io_context, unsigned short port, std::shared_ptr< RepositoryManager > repo_manager, std::shared_ptr< ISubject > event_bus)
Constructs a Server with specified dependencies.
Definition Server.cxx:24
unsigned short getPort() const
Gets the port number the server is listening on.
Definition Server.cxx:104
Core VCS data structures and object model.
Server-side components and administration commands.
Service layer components and infrastructure services.