2016-10-04 16:25:11 -07:00
|
|
|
#ifndef PHOTON_SCHEDULER_H
|
|
|
|
#define PHOTON_SCHEDULER_H
|
|
|
|
|
|
|
|
#include "task.h"
|
|
|
|
|
|
|
|
typedef struct local_scheduler_state local_scheduler_state;
|
2016-09-27 19:11:09 -07:00
|
|
|
|
2016-10-04 17:06:52 -07:00
|
|
|
/**
|
|
|
|
* Establish a connection to a new client.
|
|
|
|
*
|
|
|
|
* @param loop Event loop of the local scheduler.
|
|
|
|
* @param listener_socket Socket the local scheduler is listening on for new
|
2016-10-05 13:30:10 -07:00
|
|
|
* client requests.
|
2016-10-04 17:06:52 -07:00
|
|
|
* @param context State of the local scheduler.
|
|
|
|
* @param events Flag for events that are available on the listener socket.
|
2016-10-05 13:30:10 -07:00
|
|
|
* @return Void.
|
2016-10-04 17:06:52 -07:00
|
|
|
*/
|
2016-10-04 16:25:11 -07:00
|
|
|
void new_client_connection(event_loop *loop, int listener_sock, void *context,
|
|
|
|
int events);
|
2016-09-27 19:11:09 -07:00
|
|
|
|
2016-10-04 17:06:52 -07:00
|
|
|
/**
|
|
|
|
* Assign a task to a worker.
|
|
|
|
*
|
|
|
|
* @param s State of the local scheduler.
|
|
|
|
* @param client_sock Socket by which the worker is connected.
|
2016-10-05 13:30:10 -07:00
|
|
|
* @return Void.
|
2016-10-04 17:06:52 -07:00
|
|
|
*/
|
2016-10-04 16:25:11 -07:00
|
|
|
void handle_get_task(local_scheduler_state *s, int client_sock);
|
2016-09-27 19:11:09 -07:00
|
|
|
|
2016-10-04 17:06:52 -07:00
|
|
|
/**
|
|
|
|
* Handle incoming submit request by a worker.
|
|
|
|
*
|
|
|
|
* @param s State of the local scheduler.
|
|
|
|
* @param task Task specification of the task to be submitted.
|
2016-10-05 13:30:10 -07:00
|
|
|
* @return Void.
|
2016-10-04 17:06:52 -07:00
|
|
|
*/
|
2016-10-04 16:25:11 -07:00
|
|
|
void handle_submit_task(local_scheduler_state *s, task_spec *task);
|
2016-09-27 19:11:09 -07:00
|
|
|
|
2016-10-04 16:25:11 -07:00
|
|
|
#endif /* PHOTON_SCHEDULER_H */
|