Change type naming convention. (#315)

* Rename object_id -> ObjectID.

* Rename ray_logger -> RayLogger.

* rename task_id -> TaskID, actor_id -> ActorID, function_id -> FunctionID

* Rename plasma_store_info -> PlasmaStoreInfo.

* Rename plasma_store_state -> PlasmaStoreState.

* Rename plasma_object -> PlasmaObject.

* Rename object_request -> ObjectRequests.

* Rename eviction_state -> EvictionState.

* Bug fix.

* rename db_handle -> DBHandle

* Rename local_scheduler_state -> LocalSchedulerState.

* rename db_client_id -> DBClientID

* rename task -> Task

* make redis.c C++ compatible

* Rename scheduling_algorithm_state -> SchedulingAlgorithmState.

* Rename plasma_connection -> PlasmaConnection.

* Rename client_connection -> ClientConnection.

* Fixes from rebase.

* Rename local_scheduler_client -> LocalSchedulerClient.

* Rename object_buffer -> ObjectBuffer.

* Rename client -> Client.

* Rename notification_queue -> NotificationQueue.

* Rename object_get_requests -> ObjectGetRequests.

* Rename get_request -> GetRequest.

* Rename object_info -> ObjectInfo.

* Rename scheduler_object_info -> SchedulerObjectInfo.

* Rename local_scheduler -> LocalScheduler and some fixes.

* Rename local_scheduler_info -> LocalSchedulerInfo.

* Rename global_scheduler_state -> GlobalSchedulerState.

* Rename global_scheduler_policy_state -> GlobalSchedulerPolicyState.

* Rename object_size_entry -> ObjectSizeEntry.

* Rename aux_address_entry -> AuxAddressEntry.

* Rename various ID helper methods.

* Rename Task helper methods.

* Rename db_client_cache_entry -> DBClientCacheEntry.

* Rename local_actor_info -> LocalActorInfo.

* Rename actor_info -> ActorInfo.

* Rename retry_info -> RetryInfo.

* Rename actor_notification_table_subscribe_data -> ActorNotificationTableSubscribeData.

* Rename local_scheduler_table_send_info_data -> LocalSchedulerTableSendInfoData.

* Rename table_callback_data -> TableCallbackData.

* Rename object_info_subscribe_data -> ObjectInfoSubscribeData.

* Rename local_scheduler_table_subscribe_data -> LocalSchedulerTableSubscribeData.

* Rename more redis call data structures.

* Rename photon_conn PhotonConnection.

* Rename photon_mock -> PhotonMock.

* Fix formatting errors.
This commit is contained in:
Philipp Moritz
2017-02-26 00:32:43 -08:00
committed by Robert Nishihara
parent be1618f041
commit a30eed452e
64 changed files with 2020 additions and 2115 deletions
+72 -72
View File
@@ -45,9 +45,9 @@ uint8_t *read_message_from_file(int fd, int message_type) {
return data;
}
plasma_object random_plasma_object(void) {
PlasmaObject random_plasma_object(void) {
int random = rand();
plasma_object object;
PlasmaObject object;
memset(&object, 0, sizeof(object));
object.handle.store_fd = random + 7;
object.handle.mmap_size = random + 42;
@@ -60,18 +60,18 @@ plasma_object random_plasma_object(void) {
TEST plasma_create_request_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
int64_t data_size1 = 42;
int64_t metadata_size1 = 11;
plasma_send_CreateRequest(fd, g_B, object_id1, data_size1, metadata_size1);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaCreateRequest);
object_id object_id2;
ObjectID object_id2;
int64_t data_size2;
int64_t metadata_size2;
plasma_read_CreateRequest(data, &object_id2, &data_size2, &metadata_size2);
ASSERT_EQ(data_size1, data_size2);
ASSERT_EQ(metadata_size1, metadata_size2);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
free(data);
close(fd);
PASS();
@@ -79,16 +79,16 @@ TEST plasma_create_request_test(void) {
TEST plasma_create_reply_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
plasma_object object1 = random_plasma_object();
ObjectID object_id1 = globally_unique_id();
PlasmaObject object1 = random_plasma_object();
plasma_send_CreateReply(fd, g_B, object_id1, &object1, 0);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaCreateReply);
object_id object_id2;
plasma_object object2;
ObjectID object_id2;
PlasmaObject object2;
memset(&object2, 0, sizeof(object2));
int error_code;
plasma_read_CreateReply(data, &object_id2, &object2, &error_code);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
ASSERT(memcmp(&object1, &object2, sizeof(object1)) == 0);
free(data);
close(fd);
@@ -97,15 +97,15 @@ TEST plasma_create_reply_test(void) {
TEST plasma_seal_request_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
unsigned char digest1[DIGEST_SIZE];
memset(&digest1[0], 7, DIGEST_SIZE);
plasma_send_SealRequest(fd, g_B, object_id1, &digest1[0]);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaSealRequest);
object_id object_id2;
ObjectID object_id2;
unsigned char digest2[DIGEST_SIZE];
plasma_read_SealRequest(data, &object_id2, &digest2[0]);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
ASSERT(memcmp(&digest1[0], &digest2[0], DIGEST_SIZE) == 0);
free(data);
close(fd);
@@ -114,14 +114,14 @@ TEST plasma_seal_request_test(void) {
TEST plasma_seal_reply_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
int error1 = 5;
plasma_send_SealReply(fd, g_B, object_id1, error1);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaSealReply);
object_id object_id2;
ObjectID object_id2;
int error2;
plasma_read_SealReply(data, &object_id2, &error2);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
ASSERT(error1 == error2);
free(data);
close(fd);
@@ -130,18 +130,18 @@ TEST plasma_seal_reply_test(void) {
TEST plasma_get_request_test(void) {
int fd = create_temp_file();
object_id object_ids[2];
ObjectID object_ids[2];
object_ids[0] = globally_unique_id();
object_ids[1] = globally_unique_id();
int64_t timeout_ms = 1234;
plasma_send_GetRequest(fd, g_B, object_ids, 2, timeout_ms);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaGetRequest);
int64_t num_objects;
object_id object_ids_return[2];
ObjectID object_ids_return[2];
int64_t timeout_ms_return;
plasma_read_GetRequest(data, &object_ids_return[0], &timeout_ms_return, 2);
ASSERT(object_ids_equal(object_ids[0], object_ids_return[0]));
ASSERT(object_ids_equal(object_ids[1], object_ids_return[1]));
ASSERT(ObjectID_equal(object_ids[0], object_ids_return[0]));
ASSERT(ObjectID_equal(object_ids[1], object_ids_return[1]));
ASSERT(timeout_ms == timeout_ms_return);
free(data);
close(fd);
@@ -150,25 +150,25 @@ TEST plasma_get_request_test(void) {
TEST plasma_get_reply_test(void) {
int fd = create_temp_file();
object_id object_ids[2];
ObjectID object_ids[2];
object_ids[0] = globally_unique_id();
object_ids[1] = globally_unique_id();
plasma_object plasma_objects[2];
PlasmaObject plasma_objects[2];
plasma_objects[0] = random_plasma_object();
plasma_objects[1] = random_plasma_object();
plasma_send_GetReply(fd, g_B, object_ids, plasma_objects, 2);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaGetReply);
int64_t num_objects = plasma_read_GetRequest_num_objects(data);
object_id object_ids_return[num_objects];
plasma_object plasma_objects_return[2];
ObjectID object_ids_return[num_objects];
PlasmaObject plasma_objects_return[2];
plasma_read_GetReply(data, object_ids_return, &plasma_objects_return[0],
num_objects);
ASSERT(object_ids_equal(object_ids[0], object_ids_return[0]));
ASSERT(object_ids_equal(object_ids[1], object_ids_return[1]));
ASSERT(ObjectID_equal(object_ids[0], object_ids_return[0]));
ASSERT(ObjectID_equal(object_ids[1], object_ids_return[1]));
ASSERT(memcmp(&plasma_objects[0], &plasma_objects_return[0],
sizeof(plasma_object)) == 0);
sizeof(PlasmaObject)) == 0);
ASSERT(memcmp(&plasma_objects[1], &plasma_objects_return[1],
sizeof(plasma_object)) == 0);
sizeof(PlasmaObject)) == 0);
free(data);
close(fd);
PASS();
@@ -176,12 +176,12 @@ TEST plasma_get_reply_test(void) {
TEST plasma_release_request_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
plasma_send_ReleaseRequest(fd, g_B, object_id1);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaReleaseRequest);
object_id object_id2;
ObjectID object_id2;
plasma_read_ReleaseRequest(data, &object_id2);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
free(data);
close(fd);
PASS();
@@ -189,14 +189,14 @@ TEST plasma_release_request_test(void) {
TEST plasma_release_reply_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
int error1 = 5;
plasma_send_ReleaseReply(fd, g_B, object_id1, error1);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaReleaseReply);
object_id object_id2;
ObjectID object_id2;
int error2;
plasma_read_ReleaseReply(data, &object_id2, &error2);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
ASSERT(error1 == error2);
free(data);
close(fd);
@@ -205,12 +205,12 @@ TEST plasma_release_reply_test(void) {
TEST plasma_delete_request_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
plasma_send_DeleteRequest(fd, g_B, object_id1);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaDeleteRequest);
object_id object_id2;
ObjectID object_id2;
plasma_read_DeleteRequest(data, &object_id2);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
free(data);
close(fd);
PASS();
@@ -218,14 +218,14 @@ TEST plasma_delete_request_test(void) {
TEST plasma_delete_reply_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
int error1 = 5;
plasma_send_DeleteReply(fd, g_B, object_id1, error1);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaDeleteReply);
object_id object_id2;
ObjectID object_id2;
int error2;
plasma_read_DeleteReply(data, &object_id2, &error2);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
ASSERT(error1 == error2);
free(data);
close(fd);
@@ -234,16 +234,16 @@ TEST plasma_delete_reply_test(void) {
TEST plasma_status_request_test(void) {
int fd = create_temp_file();
object_id object_ids[2];
ObjectID object_ids[2];
object_ids[0] = globally_unique_id();
object_ids[1] = globally_unique_id();
plasma_send_StatusRequest(fd, g_B, object_ids, 2);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaStatusRequest);
int64_t num_objects = plasma_read_StatusRequest_num_objects(data);
object_id object_ids_read[num_objects];
ObjectID object_ids_read[num_objects];
plasma_read_StatusRequest(data, object_ids_read, num_objects);
ASSERT(object_ids_equal(object_ids[0], object_ids_read[0]));
ASSERT(object_ids_equal(object_ids[1], object_ids_read[1]));
ASSERT(ObjectID_equal(object_ids[0], object_ids_read[0]));
ASSERT(ObjectID_equal(object_ids[1], object_ids_read[1]));
free(data);
close(fd);
PASS();
@@ -251,19 +251,19 @@ TEST plasma_status_request_test(void) {
TEST plasma_status_reply_test(void) {
int fd = create_temp_file();
object_id object_ids[2];
ObjectID object_ids[2];
object_ids[0] = globally_unique_id();
object_ids[1] = globally_unique_id();
int object_statuses[2] = {42, 43};
plasma_send_StatusReply(fd, g_B, object_ids, object_statuses, 2);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaStatusReply);
int64_t num_objects = plasma_read_StatusReply_num_objects(data);
object_id object_ids_read[num_objects];
ObjectID object_ids_read[num_objects];
int object_statuses_read[num_objects];
plasma_read_StatusReply(data, object_ids_read, object_statuses_read,
num_objects);
ASSERT(object_ids_equal(object_ids[0], object_ids_read[0]));
ASSERT(object_ids_equal(object_ids[1], object_ids_read[1]));
ASSERT(ObjectID_equal(object_ids[0], object_ids_read[0]));
ASSERT(ObjectID_equal(object_ids[1], object_ids_read[1]));
ASSERT_EQ(object_statuses[0], object_statuses_read[0]);
ASSERT_EQ(object_statuses[1], object_statuses_read[1]);
free(data);
@@ -274,7 +274,7 @@ TEST plasma_status_reply_test(void) {
TEST plasma_evict_request_test(void) {
int fd = create_temp_file();
int64_t num_bytes = 111;
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
plasma_send_EvictRequest(fd, g_B, num_bytes);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaEvictRequest);
int64_t num_bytes_received;
@@ -288,7 +288,7 @@ TEST plasma_evict_request_test(void) {
TEST plasma_evict_reply_test(void) {
int fd = create_temp_file();
int64_t num_bytes = 111;
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
plasma_send_EvictReply(fd, g_B, num_bytes);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaEvictReply);
int64_t num_bytes_received;
@@ -301,15 +301,15 @@ TEST plasma_evict_reply_test(void) {
TEST plasma_fetch_request_test(void) {
int fd = create_temp_file();
object_id object_ids[2];
ObjectID object_ids[2];
object_ids[0] = globally_unique_id();
object_ids[1] = globally_unique_id();
plasma_send_FetchRequest(fd, g_B, object_ids, 2);
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaFetchRequest);
object_id object_ids_read[2];
ObjectID object_ids_read[2];
plasma_read_FetchRequest(data, &object_ids_read[0], 2);
ASSERT(object_ids_equal(object_ids[0], object_ids_read[0]));
ASSERT(object_ids_equal(object_ids[1], object_ids_read[1]));
ASSERT(ObjectID_equal(object_ids[0], object_ids_read[0]));
ASSERT(ObjectID_equal(object_ids[1], object_ids_read[1]));
free(data);
close(fd);
PASS();
@@ -317,7 +317,7 @@ TEST plasma_fetch_request_test(void) {
TEST plasma_wait_request_test(void) {
int fd = create_temp_file();
object_request object_requests[2];
ObjectRequest object_requests[2];
object_requests[0].object_id = globally_unique_id();
object_requests[0].type = PLASMA_QUERY_ANYWHERE;
object_requests[1].object_id = globally_unique_id();
@@ -328,17 +328,17 @@ TEST plasma_wait_request_test(void) {
timeout_ms);
/* Read message back. */
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaWaitRequest);
object_request object_requests_read[2];
ObjectRequest object_requests_read[2];
int num_object_ids_read = plasma_read_WaitRequest_num_object_ids(data);
ASSERT_EQ(num_object_ids_read, 2);
int num_ready_objects_read;
int64_t timeout_ms_read;
plasma_read_WaitRequest(data, &object_requests_read[0], num_object_ids_read,
&timeout_ms_read, &num_ready_objects_read);
ASSERT(object_ids_equal(object_requests[0].object_id,
object_requests_read[0].object_id));
ASSERT(object_ids_equal(object_requests[1].object_id,
object_requests_read[1].object_id));
ASSERT(ObjectID_equal(object_requests[0].object_id,
object_requests_read[0].object_id));
ASSERT(ObjectID_equal(object_requests[1].object_id,
object_requests_read[1].object_id));
ASSERT(object_requests[0].type == object_requests_read[0].type);
ASSERT(object_requests[1].type == object_requests_read[1].type);
free(data);
@@ -348,7 +348,7 @@ TEST plasma_wait_request_test(void) {
TEST plasma_wait_reply_test(void) {
int fd = create_temp_file();
object_request object_replies1[2];
ObjectRequest object_replies1[2];
object_replies1[0].object_id = globally_unique_id();
object_replies1[0].status = ObjectStatus_Local;
object_replies1[1].object_id = globally_unique_id();
@@ -357,13 +357,13 @@ TEST plasma_wait_reply_test(void) {
plasma_send_WaitReply(fd, g_B, object_replies1, num_ready_objects1);
/* Read message back. */
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaWaitReply);
object_request object_replies2[2];
ObjectRequest object_replies2[2];
int num_ready_objects_read2;
plasma_read_WaitReply(data, &object_replies2[0], &num_ready_objects_read2);
ASSERT(object_ids_equal(object_replies1[0].object_id,
object_replies2[0].object_id));
ASSERT(object_ids_equal(object_replies1[1].object_id,
object_replies2[1].object_id));
ASSERT(ObjectID_equal(object_replies1[0].object_id,
object_replies2[0].object_id));
ASSERT(ObjectID_equal(object_replies1[1].object_id,
object_replies2[1].object_id));
ASSERT(object_replies1[0].status == object_replies2[0].status);
ASSERT(object_replies1[1].status == object_replies2[1].status);
free(data);
@@ -373,17 +373,17 @@ TEST plasma_wait_reply_test(void) {
TEST plasma_data_request_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
const char *address1 = "address1";
int port1 = 12345;
plasma_send_DataRequest(fd, g_B, object_id1, address1, port1);
/* Reading message back. */
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaDataRequest);
object_id object_id2;
ObjectID object_id2;
char *address2;
int port2;
plasma_read_DataRequest(data, &object_id2, &address2, &port2);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
ASSERT(strcmp(address1, address2) == 0);
ASSERT(port1 == port2);
free(address2);
@@ -394,17 +394,17 @@ TEST plasma_data_request_test(void) {
TEST plasma_data_reply_test(void) {
int fd = create_temp_file();
object_id object_id1 = globally_unique_id();
ObjectID object_id1 = globally_unique_id();
int64_t object_size1 = 146;
int64_t metadata_size1 = 198;
plasma_send_DataReply(fd, g_B, object_id1, object_size1, metadata_size1);
/* Reading message back. */
uint8_t *data = read_message_from_file(fd, MessageType_PlasmaDataReply);
object_id object_id2;
ObjectID object_id2;
int64_t object_size2;
int64_t metadata_size2;
plasma_read_DataReply(data, &object_id2, &object_size2, &metadata_size2);
ASSERT(object_ids_equal(object_id1, object_id2));
ASSERT(ObjectID_equal(object_id1, object_id2));
ASSERT(object_size1 == object_size2);
ASSERT(metadata_size1 == metadata_size2);
free(data);