#ifndef REMOTE_POOL_H
#define REMOTE_POOL_H
#include "remote_node.h"
// maximum number of nodes in a remote pool
#define REMOTE_POOL_MAX 8
// how many bytes long each line in a pool file may be
#define POOL_FILE_LINE_LENGTH 512
struct remote_pool {
// the remote_nodes are part of this struct
struct remote_node nodes[REMOTE_POOL_MAX];
};
/*
* Initialize the given remote_pool
*/
void remote_pool_init (struct remote_pool *pool_info);
/*
* Add a remote_node to the pool, see remote_node_init
*/
int remote_pool_add (struct remote_pool *pool_info, const char *hostname, const char *portname);
/*
* Adds remote_nodes to the pool based on the contents of the given file
*
* The format for the file is a set of "<hostname>:<portname>" lines, see
* parse_hostport in common.h. Blank lines are skipped, and any comments
* prefixed with a '#' char is ignored. Whitespace inside lines is also
* ignored.
*
* Returns however many nodes were added (possibly zero), or -1 on error
*/
int remote_pool_load (struct remote_pool *pool_info, const char *filename);
/*
* Choose a remote_node from the pool
*
* Attempts to pick the one that's least busy
*/
struct remote_node *remote_pool_get (struct remote_pool *pool_info);
/*
* Get the number of remote render nodes in this pool
*/
int remote_pool_size (struct remote_pool *pool_info);
#endif /* REMOTE_POOL_H */