MCPcopy Create free account
hub / github.com/XTXMarkets/ternfs / insert

Method insert

cpp/cdc/CDC.cpp:195–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193 }
194
195 void insert(uint64_t reqId, const InFlightShardRequest& req) {
196 auto [reqIt, inserted] = _reqs.insert({reqId, req});
197
198 // TODO i think we can just assert inserted, we never need this
199 // functionality
200
201 if (inserted) {
202 // we have never seen this shard request.
203 // technically we could get the same time twice, but in practice
204 // we won't, so just assert it.
205 ALWAYS_ASSERT(_pq.insert({req.sentAt, reqId}).second);
206 } else {
207 // we had already seen this. make sure it's for the same stuff, and update pq.
208 ALWAYS_ASSERT(reqIt->second.txnId == req.txnId);
209 ALWAYS_ASSERT(reqIt->second.shid == req.shid);
210 ALWAYS_ASSERT(_pq.erase(reqIt->second.sentAt) == 1); // must be already present
211 ALWAYS_ASSERT(_pq.insert({req.sentAt, reqId}).second); // insert with new time
212 reqIt->second.sentAt = req.sentAt; // update time in existing entry
213 }
214 }
215};
216
217struct CDCReqInfo {

Callers 15

stepMethod · 0.45
_stepNextWakeupMethod · 0.45
openMethod · 0.45
openTransactionDBMethod · 0.45
openForReadOnlyMethod · 0.45
registerCFDescriptorsMethod · 0.45
parse_query_textFunction · 0.45
parse_disposition_paramsFunction · 0.45
send_Method · 0.45
handle_requestMethod · 0.45
write_requestMethod · 0.45

Calls 1

eraseMethod · 0.80

Tested by 1

mainFunction · 0.36