Files
ray/src/common/state/task_log.c
T
Ion ee3718c80c Ion and Philipp's table retries (#10)
* Ion and Philipp's table retries

* Refactor the retry struct:
- Rename it from retry_struct to retry_info
- Retry information contains the failure callback, not the retry callback
- All functions take in retry information as an arg instead of its expanded fields

* Rename cb -> callback

* Remove prints

* Fix compiler warnings

* Change some CHECKs to greatest ASSERTs

* Key outstanding callbacks hash table with timer ID instead of callback data pointer

* Use the new retry API for table commands

* Memory cleanup in plasma unit tests

* fix Robert's comments

* add valgrind for common
2016-10-29 15:22:33 -07:00

35 lines
1.4 KiB
C

#include "task_log.h"
#include "redis.h"
#define NUM_DB_REQUESTS 2
void task_log_publish(db_handle *db_handle,
task_instance *task_instance,
retry_info *retry,
task_log_done_callback done_callback,
void *user_context) {
init_table_callback(db_handle, *task_instance_id(task_instance),
task_instance, retry, done_callback,
redis_task_log_publish, user_context);
}
/* TODO(swang): A corresponding task_log_unsubscribe. */
void task_log_subscribe(db_handle *db_handle,
node_id node,
int32_t state_filter,
task_log_subscribe_callback subscribe_callback,
void *subscribe_context,
retry_info *retry,
task_log_done_callback done_callback,
void *user_context) {
task_log_subscribe_data *sub_data = malloc(sizeof(task_log_subscribe_data));
utarray_push_back(db_handle->callback_freelist, &sub_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, sub_data, retry, done_callback,
redis_task_log_subscribe, user_context);
}