| 915 | } |
| 916 | |
| 917 | ExtMsgUpdate::ExtMsgUpdate(ExtMsgHeader* header, const uint8_t* body) : header(header) { |
| 918 | const uint8_t* ptr = body; |
| 919 | const uint8_t* eom = (const uint8_t*)header + header->messageLength; |
| 920 | |
| 921 | ptr += sizeof(int32_t); // mongo OP_UPDATE begins with int32 ZERO, reserved for future use |
| 922 | |
| 923 | const char* collName = (const char*)ptr; |
| 924 | ptr += strlen(collName) + 1; |
| 925 | ns = getDBCollectionPair(collName, std::make_pair("msgType", "OP_UPDATE")); |
| 926 | |
| 927 | flags = *(int32_t*)ptr; |
| 928 | ptr += sizeof(int32_t); |
| 929 | |
| 930 | upsert = ((flags & Flags::UPSERT) == Flags::UPSERT); |
| 931 | multi = ((flags & Flags::MULTI) == Flags::MULTI); |
| 932 | |
| 933 | selector = bson::BSONObj((const char*)ptr); |
| 934 | ptr += selector.objsize(); |
| 935 | update = bson::BSONObj((const char*)ptr); |
| 936 | ptr += update.objsize(); |
| 937 | |
| 938 | ASSERT(ptr == eom); |
| 939 | } |
| 940 | |
| 941 | std::string ExtMsgUpdate::toString() { |
| 942 | return format("UPDATE: selector=%s, update=%s, collection=%s, flags=%d (%s)", selector.toString().c_str(), |
nothing calls this directly
no test coverage detected