|
24 | 24 | #include "arrow/status.h"
|
25 | 25 |
|
26 | 26 | #include "plasma/common.h"
|
| 27 | +#include "plasma/plasma_generated.h" |
27 | 28 |
|
28 | 29 | using arrow::Status;
|
29 | 30 |
|
@@ -58,7 +59,7 @@ Status WriteBytes(int fd, uint8_t* cursor, size_t length) {
|
58 | 59 | }
|
59 | 60 |
|
60 | 61 | Status WriteMessage(int fd, int64_t type, int64_t length, uint8_t* bytes) {
|
61 |
| - int64_t version = PLASMA_PROTOCOL_VERSION; |
| 62 | + int64_t version = kPlasmaProtocolVersion; |
62 | 63 | RETURN_NOT_OK(WriteBytes(fd, reinterpret_cast<uint8_t*>(&version), sizeof(version)));
|
63 | 64 | RETURN_NOT_OK(WriteBytes(fd, reinterpret_cast<uint8_t*>(&type), sizeof(type)));
|
64 | 65 | RETURN_NOT_OK(WriteBytes(fd, reinterpret_cast<uint8_t*>(&length), sizeof(length)));
|
@@ -91,20 +92,20 @@ Status ReadBytes(int fd, uint8_t* cursor, size_t length) {
|
91 | 92 | Status ReadMessage(int fd, int64_t* type, std::vector<uint8_t>* buffer) {
|
92 | 93 | int64_t version;
|
93 | 94 | RETURN_NOT_OK_ELSE(ReadBytes(fd, reinterpret_cast<uint8_t*>(&version), sizeof(version)),
|
94 |
| - *type = DISCONNECT_CLIENT); |
95 |
| - ARROW_CHECK(version == PLASMA_PROTOCOL_VERSION) << "version = " << version; |
| 95 | + *type = MessageType_PlasmaDisconnectClient); |
| 96 | + ARROW_CHECK(version == kPlasmaProtocolVersion) << "version = " << version; |
96 | 97 | RETURN_NOT_OK_ELSE(ReadBytes(fd, reinterpret_cast<uint8_t*>(type), sizeof(*type)),
|
97 |
| - *type = DISCONNECT_CLIENT); |
| 98 | + *type = MessageType_PlasmaDisconnectClient); |
98 | 99 | int64_t length_temp;
|
99 | 100 | RETURN_NOT_OK_ELSE(
|
100 | 101 | ReadBytes(fd, reinterpret_cast<uint8_t*>(&length_temp), sizeof(length_temp)),
|
101 |
| - *type = DISCONNECT_CLIENT); |
| 102 | + *type = MessageType_PlasmaDisconnectClient); |
102 | 103 | // The length must be read as an int64_t, but it should be used as a size_t.
|
103 | 104 | size_t length = static_cast<size_t>(length_temp);
|
104 | 105 | if (length > buffer->size()) {
|
105 | 106 | buffer->resize(length);
|
106 | 107 | }
|
107 |
| - RETURN_NOT_OK_ELSE(ReadBytes(fd, buffer->data(), length), *type = DISCONNECT_CLIENT); |
| 108 | + RETURN_NOT_OK_ELSE(ReadBytes(fd, buffer->data(), length), *type = MessageType_PlasmaDisconnectClient); |
108 | 109 | return Status::OK();
|
109 | 110 | }
|
110 | 111 |
|
|
0 commit comments