| 58 | return k.withPrefix(keyServersPrefix, arena); |
| 59 | } |
| 60 | const Value keyServersValue(RangeResult result, const std::vector<UID>& src, const std::vector<UID>& dest) { |
| 61 | if (!CLIENT_KNOBS->TAG_ENCODE_KEY_SERVERS) { |
| 62 | BinaryWriter wr(IncludeVersion(ProtocolVersion::withKeyServerValue())); |
| 63 | wr << src << dest; |
| 64 | return wr.toValue(); |
| 65 | } |
| 66 | |
| 67 | std::vector<Tag> srcTag; |
| 68 | std::vector<Tag> destTag; |
| 69 | |
| 70 | bool foundOldLocality = false; |
| 71 | for (const KeyValueRef& kv : result) { |
| 72 | UID uid = decodeServerTagKey(kv.key); |
| 73 | if (std::find(src.begin(), src.end(), uid) != src.end()) { |
| 74 | srcTag.push_back(decodeServerTagValue(kv.value)); |
| 75 | if (srcTag.back().locality == tagLocalityUpgraded) { |
| 76 | foundOldLocality = true; |
| 77 | break; |
| 78 | } |
| 79 | } |
| 80 | if (std::find(dest.begin(), dest.end(), uid) != dest.end()) { |
| 81 | destTag.push_back(decodeServerTagValue(kv.value)); |
| 82 | if (destTag.back().locality == tagLocalityUpgraded) { |
| 83 | foundOldLocality = true; |
| 84 | break; |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | if (foundOldLocality || src.size() != srcTag.size() || dest.size() != destTag.size()) { |
| 90 | ASSERT_WE_THINK(foundOldLocality); |
| 91 | BinaryWriter wr(IncludeVersion(ProtocolVersion::withKeyServerValue())); |
| 92 | wr << src << dest; |
| 93 | return wr.toValue(); |
| 94 | } |
| 95 | |
| 96 | return keyServersValue(srcTag, destTag); |
| 97 | } |
| 98 | |
| 99 | const Value keyServersValue(const std::vector<UID>& src, |
| 100 | const std::vector<UID>& dest, |
no test coverage detected