MCPcopy Create free account
hub / github.com/FoundationDB/fdb-document-layer / ExtMsgQuery

Method ExtMsgQuery

src/ExtMsg.actor.cpp:197–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197ExtMsgQuery::ExtMsgQuery(ExtMsgHeader* header, const uint8_t* body) : header(header) {
198 const uint8_t* ptr = body;
199 const uint8_t* eom = (uint8_t*)header + header->messageLength;
200
201 flags = *(int32_t*)ptr;
202 ptr += sizeof(int32_t);
203
204 const char* collName = (const char*)ptr;
205 ptr += strlen(collName) + 1;
206
207 numberToSkip = *(int32_t*)ptr;
208 ptr += sizeof(int32_t);
209 numberToReturn = *(int32_t*)ptr;
210 ptr += sizeof(int32_t);
211
212 query = bson::BSONObj((const char*)ptr);
213 ptr += query.objsize();
214
215 if (ptr != eom) {
216 returnFieldSelector = bson::BSONObj((const char*)ptr);
217 ptr += returnFieldSelector.objsize();
218 }
219
220 ns = getDBCollectionPair(collName, std::make_pair(DocLayerConstants::QUERY_FIELD, query.toString()));
221 if (ns.second == "$cmd") {
222 isCmd = true;
223 // Mark it empty for now, command would be responsible for setting collection name later.
224 ns.second = "";
225 } else {
226 isCmd = false;
227 }
228
229 /* We should have consumed all the bytes specified by header */
230 ASSERT(ptr == eom);
231}
232
233std::string ExtMsgQuery::toString() {
234 return format("QUERY: %s, collection=%s, flags=%d, numberToSkip=%d, numberToReturn=%d (%s)",

Callers

nothing calls this directly

Calls 2

getDBCollectionPairFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected