2 #define _SERVERPOOL_H 1
16 // Provides services such as load-balancing between a number of Server instances.
19 ServerPool(int num_servers);
22 // Fills streams() and clients().
23 CubemapStateProto serialize();
25 // Picks a server (round-robin) and allocates the given client to it.
26 void add_client(int sock);
27 void add_client_from_serialized(const ClientProto &client);
29 // Adds the given stream to all the servers.
30 void add_stream(const std::string &stream_id, size_t backlog_size, Stream::Encoding encoding);
31 void add_stream_from_serialized(const StreamProto &stream, const std::vector<int> &data_fds);
33 // Adds the given data to all the servers.
34 void set_header(const std::string &stream_id,
35 const std::string &http_header,
36 const std::string &stream_header);
37 void add_data(const std::string &stream_id, const char *data, size_t bytes);
39 // Connects the given stream to the given mark pool for all the servers.
40 void set_mark_pool(const std::string &stream_id, MarkPool *mark_pool);
42 // Changes the given stream's backlog size on all the servers.
43 void set_backlog_size(const std::string &stream_id, size_t new_size);
45 // Changes the given stream's encoding type on all the servers.
46 void set_encoding(const std::string &stream_id, Stream::Encoding encoding);
48 // Starts all the servers.
51 // Stops all the servers.
54 std::vector<ClientStats> get_client_stats() const;
58 int num_servers, clients_added;
60 ServerPool(const ServerPool &);
63 #endif // !defined(_SERVERPOOL_H)