MCPcopy Create free account
hub / github.com/apple/foundationdb / updateTssMappings

Function updateTssMappings

fdbclient/NativeAPI.actor.cpp:2821–2842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2819}
2820
2821void updateTssMappings(Database cx, const GetKeyServerLocationsReply& reply) {
2822 // Since a ss -> tss mapping is included in resultsTssMapping iff that SS is in results and has a tss pair,
2823 // all SS in results that do not have a mapping present must not have a tss pair.
2824 std::unordered_map<UID, const StorageServerInterface*> ssiById;
2825 for (const auto& [_, shard] : reply.results) {
2826 for (auto& ssi : shard) {
2827 ssiById[ssi.id()] = &ssi;
2828 }
2829 }
2830
2831 for (const auto& mapping : reply.resultsTssMapping) {
2832 auto ssi = ssiById.find(mapping.first);
2833 ASSERT(ssi != ssiById.end());
2834 cx->addTssMapping(*ssi->second, mapping.second);
2835 ssiById.erase(mapping.first);
2836 }
2837
2838 // if SS didn't have a mapping above, it's still in the ssiById map, so remove its tss mapping
2839 for (const auto& it : ssiById) {
2840 cx->removeTssMapping(*it.second);
2841 }
2842}
2843
2844void updateTagMappings(Database cx, const GetKeyServerLocationsReply& reply) {
2845 for (const auto& mapping : reply.resultsTagMapping) {

Callers 1

whenFunction · 0.85

Calls 6

addTssMappingMethod · 0.80
removeTssMappingMethod · 0.80
idMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected