2016-10-04 16:25:11 -07:00
|
|
|
#ifndef PHOTON_SCHEDULER_H
|
|
|
|
#define PHOTON_SCHEDULER_H
|
|
|
|
|
|
|
|
#include "task.h"
|
2016-10-18 18:27:43 -07:00
|
|
|
#include "event_loop.h"
|
2016-10-04 16:25:11 -07:00
|
|
|
|
|
|
|
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-18 18:27:43 -07:00
|
|
|
void new_client_connection(event_loop *loop,
|
|
|
|
int listener_sock,
|
|
|
|
void *context,
|
2016-10-04 16:25:11 -07:00
|
|
|
int events);
|
2016-09-27 19:11:09 -07:00
|
|
|
|
2016-10-04 17:06:52 -07:00
|
|
|
/**
|
2016-10-18 18:27:43 -07:00
|
|
|
* This function can be called by the scheduling algorithm to assign a task
|
|
|
|
* to a worker.
|
2016-10-04 17:06:52 -07:00
|
|
|
*
|
2016-10-18 18:27:43 -07:00
|
|
|
* @param info
|
|
|
|
* @param task The task that is submitted to the worker.
|
|
|
|
* @param worker_index The index of the worker the task is submitted to.
|
2016-11-18 19:57:51 -08:00
|
|
|
* @param from_global_scheduler True if the task was assigned to the local
|
|
|
|
* scheduler by the global scheduler and false otherwise.
|
2016-10-05 13:30:10 -07:00
|
|
|
* @return Void.
|
2016-10-04 17:06:52 -07:00
|
|
|
*/
|
2016-10-18 18:27:43 -07:00
|
|
|
void assign_task_to_worker(scheduler_info *info,
|
|
|
|
task_spec *task,
|
2016-11-18 19:57:51 -08:00
|
|
|
int worker_index,
|
|
|
|
bool from_global_scheduler);
|
2016-09-27 19:11:09 -07:00
|
|
|
|
2016-10-04 17:06:52 -07:00
|
|
|
/**
|
2016-10-18 18:27:43 -07:00
|
|
|
* This is the callback that is used to process a notification from the Plasma
|
|
|
|
* store that an object has been sealed.
|
2016-10-04 17:06:52 -07:00
|
|
|
*
|
2016-10-18 18:27:43 -07:00
|
|
|
* @param loop The local scheduler's event loop.
|
|
|
|
* @param client_sock The file descriptor to read the notification from.
|
|
|
|
* @param context The local scheduler state.
|
|
|
|
* @param events
|
2016-10-05 13:30:10 -07:00
|
|
|
* @return Void.
|
2016-10-04 17:06:52 -07:00
|
|
|
*/
|
2016-10-18 18:27:43 -07:00
|
|
|
void process_plasma_notification(event_loop *loop,
|
|
|
|
int client_sock,
|
|
|
|
void *context,
|
|
|
|
int events);
|
2016-09-27 19:11:09 -07:00
|
|
|
|
2016-10-04 16:25:11 -07:00
|
|
|
#endif /* PHOTON_SCHEDULER_H */
|