@@ -1399,7 +1399,8 @@ std::string MetaKeyUtils::jobVal(const meta::cpp2::JobType& type,
1399
1399
std::vector<std::string> paras,
1400
1400
meta::cpp2::JobStatus jobStatus,
1401
1401
int64_t startTime,
1402
- int64_t stopTime) {
1402
+ int64_t stopTime,
1403
+ nebula::cpp2::ErrorCode errCode) {
1403
1404
std::string val;
1404
1405
val.reserve (256 );
1405
1406
val.append (reinterpret_cast <const char *>(&type), sizeof (meta::cpp2::JobType));
@@ -1412,11 +1413,17 @@ std::string MetaKeyUtils::jobVal(const meta::cpp2::JobType& type,
1412
1413
}
1413
1414
val.append (reinterpret_cast <const char *>(&jobStatus), sizeof (meta::cpp2::JobStatus))
1414
1415
.append (reinterpret_cast <const char *>(&startTime), sizeof (int64_t ))
1415
- .append (reinterpret_cast <const char *>(&stopTime), sizeof (int64_t ));
1416
+ .append (reinterpret_cast <const char *>(&stopTime), sizeof (int64_t ))
1417
+ .append (reinterpret_cast <const char *>(&errCode), sizeof (nebula::cpp2::ErrorCode));
1416
1418
return val;
1417
1419
}
1418
1420
1419
- std::tuple<meta::cpp2::JobType, std::vector<std::string>, meta::cpp2::JobStatus, int64_t , int64_t >
1421
+ std::tuple<meta::cpp2::JobType,
1422
+ std::vector<std::string>,
1423
+ meta::cpp2::JobStatus,
1424
+ int64_t ,
1425
+ int64_t ,
1426
+ nebula::cpp2::ErrorCode>
1420
1427
MetaKeyUtils::parseJobVal (folly::StringPiece rawVal) {
1421
1428
CHECK_GE (rawVal.size (),
1422
1429
sizeof (meta::cpp2::JobType) + sizeof (size_t ) + sizeof (meta::cpp2::JobStatus) +
@@ -1439,7 +1446,9 @@ MetaKeyUtils::parseJobVal(folly::StringPiece rawVal) {
1439
1446
auto tStart = *reinterpret_cast <const int64_t *>(rawVal.data () + offset);
1440
1447
offset += sizeof (int64_t );
1441
1448
auto tStop = *reinterpret_cast <const int64_t *>(rawVal.data () + offset);
1442
- return std::make_tuple (type, paras, status, tStart, tStop);
1449
+ offset += sizeof (int64_t );
1450
+ auto errCode = *reinterpret_cast <const nebula::cpp2::ErrorCode*>(rawVal.data () + offset);
1451
+ return std::make_tuple (type, paras, status, tStart, tStop, errCode);
1443
1452
}
1444
1453
1445
1454
std::pair<GraphSpaceID, JobID> MetaKeyUtils::parseJobKey (folly::StringPiece key) {
@@ -1473,20 +1482,23 @@ std::tuple<GraphSpaceID, JobID, TaskID> MetaKeyUtils::parseTaskKey(folly::String
1473
1482
std::string MetaKeyUtils::taskVal (HostAddr host,
1474
1483
meta::cpp2::JobStatus jobStatus,
1475
1484
int64_t startTime,
1476
- int64_t stopTime) {
1485
+ int64_t stopTime,
1486
+ nebula::cpp2::ErrorCode errCode) {
1477
1487
std::string val;
1478
1488
val.reserve (128 );
1479
1489
val.append (MetaKeyUtils::serializeHostAddr (host))
1480
1490
.append (reinterpret_cast <const char *>(&jobStatus), sizeof (meta::cpp2::JobStatus))
1481
1491
.append (reinterpret_cast <const char *>(&startTime), sizeof (int64_t ))
1482
- .append (reinterpret_cast <const char *>(&stopTime), sizeof (int64_t ));
1492
+ .append (reinterpret_cast <const char *>(&stopTime), sizeof (int64_t ))
1493
+ .append (reinterpret_cast <const char *>(&errCode), sizeof (nebula::cpp2::ErrorCode));
1483
1494
return val;
1484
1495
}
1485
1496
1486
- std::tuple<HostAddr, meta::cpp2::JobStatus, int64_t , int64_t > MetaKeyUtils::parseTaskVal (
1487
- folly::StringPiece rawVal) {
1497
+ std::tuple<HostAddr, meta::cpp2::JobStatus, int64_t , int64_t , nebula::cpp2::ErrorCode>
1498
+ MetaKeyUtils::parseTaskVal ( folly::StringPiece rawVal) {
1488
1499
CHECK_GE (rawVal.size (),
1489
- sizeof (size_t ) + sizeof (Port) + sizeof (meta::cpp2::JobStatus) + sizeof (int64_t ) * 2 );
1500
+ sizeof (size_t ) + sizeof (Port) + sizeof (meta::cpp2::JobStatus) + sizeof (int64_t ) * 2 +
1501
+ sizeof (nebula::cpp2::ErrorCode));
1490
1502
size_t offset = 0 ;
1491
1503
HostAddr host = MetaKeyUtils::deserializeHostAddr (rawVal);
1492
1504
offset += sizeof (size_t );
@@ -1498,7 +1510,9 @@ std::tuple<HostAddr, meta::cpp2::JobStatus, int64_t, int64_t> MetaKeyUtils::pars
1498
1510
auto tStart = *reinterpret_cast <const int64_t *>(rawVal.data () + offset);
1499
1511
offset += sizeof (int64_t );
1500
1512
auto tStop = *reinterpret_cast <const int64_t *>(rawVal.data () + offset);
1501
- return std::make_tuple (host, status, tStart, tStop);
1513
+ offset += sizeof (int64_t );
1514
+ auto errCode = *reinterpret_cast <const nebula::cpp2::ErrorCode*>(rawVal.data () + offset);
1515
+ return std::make_tuple (host, status, tStart, tStop, errCode);
1502
1516
}
1503
1517
1504
1518
} // namespace nebula
0 commit comments