2 #define _SERVERPOOL_H 1
8 // Provides services such as load-balancing between a number of Server instances.
11 ServerPool(int num_servers);
14 // Accessor. Only to be used in rare situations, really.
15 // The ServerPool retains ownership.
16 Server *get_server(int num) { return &servers[num]; }
18 // Picks a server (round-robin) and allocates the given client to it.
19 void add_client(int sock);
20 void add_client_from_serialized(const ClientProto &client);
22 // Adds the given stream to all the servers.
23 void add_stream(const std::string &stream_id);
24 void add_stream_from_serialized(const StreamProto &stream);
26 // Adds the given data to all the servers.
27 void set_header(const std::string &stream_id, const std::string &header);
28 void add_data(const std::string &stream_id, const char *data, size_t bytes);
30 // Starts all the servers.
33 std::vector<ClientStats> get_client_stats() const;
37 int num_servers, clients_added;
39 ServerPool(const ServerPool &);
42 #endif // !defined(_SERVERPOOL_H)