mirror of
https://github.com/wassname/ray.git
synced 2026-08-12 12:20:11 +08:00
Remove unused object info table code. (#1388)
This commit is contained in:
committed by
Philipp Moritz
parent
77af2b5516
commit
088f01496c
@@ -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,
|
||||
|
||||
@@ -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 ====
|
||||
*/
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user