From 088f01496c4b3b6cb4652713e67b7527d80005f6 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Fri, 5 Jan 2018 11:00:06 -0800 Subject: [PATCH] Remove unused object info table code. (#1388) --- src/common/state/object_table.cc | 17 ----------- src/common/state/object_table.h | 39 ------------------------- src/common/state/redis.cc | 50 -------------------------------- 3 files changed, 106 deletions(-) diff --git a/src/common/state/object_table.cc b/src/common/state/object_table.cc index 13a45b834..ce006d585 100644 --- a/src/common/state/object_table.cc +++ b/src/common/state/object_table.cc @@ -90,23 +90,6 @@ void object_table_request_notifications(DBHandle *db_handle, redis_object_table_request_notifications, NULL); } -void object_info_subscribe(DBHandle *db_handle, - object_info_subscribe_callback subscribe_callback, - void *subscribe_context, - RetryInfo *retry, - object_info_done_callback done_callback, - void *user_context) { - ObjectInfoSubscribeData *sub_data = - (ObjectInfoSubscribeData *) malloc(sizeof(ObjectInfoSubscribeData)); - sub_data->subscribe_callback = subscribe_callback; - sub_data->subscribe_context = subscribe_context; - - init_table_callback(db_handle, ObjectID::nil(), __func__, - new CommonCallbackData(sub_data), retry, - (table_done_callback) done_callback, - redis_object_info_subscribe, user_context); -} - void result_table_add(DBHandle *db_handle, ObjectID object_id, TaskID task_id, diff --git a/src/common/state/object_table.h b/src/common/state/object_table.h index b77920d8b..77a299dfd 100644 --- a/src/common/state/object_table.h +++ b/src/common/state/object_table.h @@ -174,45 +174,6 @@ typedef struct { void *subscribe_context; } ObjectTableSubscribeData; -/* - * ==== Object info table, contains size of the object ==== - */ - -typedef void (*object_info_done_callback)(ObjectID object_id, - void *user_context); - -typedef void (*object_info_subscribe_callback)(ObjectID object_id, - int64_t object_size, - void *user_context); - -/** - * Subcribing to the object info pub/sub channel - * - * @param db_handle Handle to db. - * @param object_info_subscribe_callback callback triggered when pub/sub channel - * is notified of a new object size. - * @param subscribe_context caller context which will be passed back in the - * object_info_subscribe_callback. - * @param retry Information about retrying the request to the database. - * @param done_callback Callback to be called when subscription is installed. - * @param user_context User context to be passed into the done and fail - * callbacks. - * @return Void. - */ -void object_info_subscribe(DBHandle *db_handle, - object_info_subscribe_callback subscribe_callback, - void *subscribe_context, - RetryInfo *retry, - object_info_done_callback done_callback, - void *user_context); - -/* Data that is needed to register new object info callbacks with the state - * database. */ -typedef struct { - object_info_subscribe_callback subscribe_callback; - void *subscribe_context; -} ObjectInfoSubscribeData; - /* * ==== Result table ==== */ diff --git a/src/common/state/redis.cc b/src/common/state/redis.cc index 9d7e0ef1a..ab7c5a9aa 100644 --- a/src/common/state/redis.cc +++ b/src/common/state/redis.cc @@ -1606,56 +1606,6 @@ void redis_actor_table_mark_removed(DBHandle *db, ActorID actor_id) { } } -void redis_object_info_subscribe_callback(redisAsyncContext *c, - void *r, - void *privdata) { - REDIS_CALLBACK_HEADER(db, callback_data, r); - redisReply *reply = (redisReply *) r; - - CHECK(reply->type == REDIS_REPLY_ARRAY); - - CHECK(reply->elements > 2); - /* First entry is message type, then possibly the regex we psubscribed to, - * then topic, then payload. */ - redisReply *payload = reply->element[reply->elements - 1]; - /* If this condition is true, we got the initial message that acknowledged the - * subscription. */ - if (payload->str == NULL) { - if (callback_data->done_callback) { - db_client_table_done_callback done_callback = - (db_client_table_done_callback) callback_data->done_callback; - done_callback(callback_data->id, callback_data->user_context); - } - /* Note that we do not destroy the callback data yet because the - * subscription callback needs this data. */ - remove_timer_callback(db->loop, callback_data); - return; - } - /* Otherwise, parse the payload and call the callback. */ - ObjectInfoSubscribeData *data = - (ObjectInfoSubscribeData *) callback_data->data->Get(); - ObjectID object_id; - memcpy(object_id.mutable_data(), payload->str, sizeof(object_id)); - /* payload->str should have the format: "ObjectID:object_size_int" */ - LOG_DEBUG("obj:info channel received message <%s>", payload->str); - if (data->subscribe_callback) { - data->subscribe_callback( - object_id, strtol(&payload->str[1 + sizeof(object_id)], NULL, 10), - data->subscribe_context); - } -} - -void redis_object_info_subscribe(TableCallbackData *callback_data) { - DBHandle *db = callback_data->db_handle; - int status = redisAsyncCommand( - db->subscribe_context, redis_object_info_subscribe_callback, - (void *) callback_data->timer_id, "PSUBSCRIBE obj:info"); - if ((status == REDIS_ERR) || db->subscribe_context->err) { - LOG_REDIS_DEBUG(db->subscribe_context, - "error in object_info_register_callback"); - } -} - void redis_push_error_rpush_callback(redisAsyncContext *c, void *r, void *privdata) {