Skip to content

Commit

Permalink
Remove unused object info table code. (ray-project#1388)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertnishihara authored and pcmoritz committed Jan 5, 2018
1 parent 77af2b5 commit 088f014
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 106 deletions.
17 changes: 0 additions & 17 deletions src/common/state/object_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
39 changes: 0 additions & 39 deletions src/common/state/object_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ====
*/
Expand Down
50 changes: 0 additions & 50 deletions src/common/state/redis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 088f014

Please sign in to comment.