mirror of
https://github.com/wassname/ray.git
synced 2026-08-06 13:31:10 +08:00
* temp commit * Stuff * Ownership is now taken by init table callback * Fixed lint errors * Fixed travis warnings * Fixed spacing * add .gitkeep * fix global scheduler * Whitespace.
52 lines
2.1 KiB
C
52 lines
2.1 KiB
C
#include "task_table.h"
|
|
#include "redis.h"
|
|
|
|
#define NUM_DB_REQUESTS 2
|
|
|
|
void task_table_get_task(db_handle *db_handle,
|
|
task_id task_id,
|
|
retry_info *retry,
|
|
task_table_get_callback done_callback,
|
|
void *user_context) {
|
|
init_table_callback(db_handle, task_id, __func__, NULL, retry, done_callback,
|
|
redis_task_table_get_task, user_context);
|
|
}
|
|
|
|
void task_table_add_task(db_handle *db_handle,
|
|
OWNER task *task,
|
|
retry_info *retry,
|
|
task_table_done_callback done_callback,
|
|
void *user_context) {
|
|
init_table_callback(db_handle, task_task_id(task), __func__, task, retry,
|
|
done_callback, redis_task_table_add_task, user_context);
|
|
}
|
|
|
|
void task_table_update(db_handle *db_handle,
|
|
OWNER task *task,
|
|
retry_info *retry,
|
|
task_table_done_callback done_callback,
|
|
void *user_context) {
|
|
init_table_callback(db_handle, task_task_id(task), __func__, task, retry,
|
|
done_callback, redis_task_table_update, user_context);
|
|
}
|
|
|
|
/* TODO(swang): A corresponding task_table_unsubscribe. */
|
|
void task_table_subscribe(db_handle *db_handle,
|
|
node_id node,
|
|
scheduling_state state_filter,
|
|
task_table_subscribe_callback subscribe_callback,
|
|
void *subscribe_context,
|
|
retry_info *retry,
|
|
task_table_done_callback done_callback,
|
|
void *user_context) {
|
|
task_table_subscribe_data *sub_data =
|
|
malloc(sizeof(task_table_subscribe_data));
|
|
sub_data->node = node;
|
|
sub_data->state_filter = state_filter;
|
|
sub_data->subscribe_callback = subscribe_callback;
|
|
sub_data->subscribe_context = subscribe_context;
|
|
|
|
init_table_callback(db_handle, node, __func__, sub_data, retry, done_callback,
|
|
redis_task_table_subscribe, user_context);
|
|
}
|