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