2 #define _SERVERPOOL_H 1
10 // Provides services such as load-balancing between a number of Server instances.
13 ServerPool(int num_servers);
16 // Accessor. Only to be used in rare situations, really.
17 // The ServerPool retains ownership.
18 Server *get_server(int num) { return &servers[num]; }
20 // Picks a server (round-robin) and allocates the given client to it.
21 void add_client(int sock);
22 void add_client_from_serialized(const ClientProto &client);
24 // Adds the given stream to all the servers.
25 void add_stream(const std::string &stream_id);
26 void add_stream_from_serialized(const StreamProto &stream);
28 // Adds the given data to all the servers.
29 void set_header(const std::string &stream_id, const std::string &header);
30 void add_data(const std::string &stream_id, const char *data, size_t bytes);
32 // Connects the given stream to the given mark pool for all the servers.
33 void set_mark_pool(const std::string &stream_id, MarkPool *mark_pool);
35 // Starts all the servers.
38 // Stops all the servers.
41 std::vector<ClientStats> get_client_stats() const;
45 int num_servers, clients_added;
47 ServerPool(const ServerPool &);
50 #endif // !defined(_SERVERPOOL_H)