Add ConfigClassSet:::contains method

This commit is contained in:
sfc-gh-tclinkenbeard 2021-05-11 18:54:37 -07:00
parent 7681f38f45
commit 8e5c396aca
3 changed files with 22 additions and 12 deletions

View File

@ -66,16 +66,18 @@ class ConfigBroadcasterImpl {
if (version > req.version) { if (version > req.version) {
break; break;
} }
TraceEvent(SevDebug, "BroadcasterAppendingMutationToFullDBOutput") if (req.configClassSet.contains(mutation.getConfigClass())) {
.detail("ReqVersion", req.version) TraceEvent(SevDebug, "BroadcasterAppendingMutationToFullDBOutput")
.detail("MutationVersion", version) .detail("ReqVersion", req.version)
.detail("ConfigClass", mutation.getConfigClass()) .detail("MutationVersion", version)
.detail("KnobName", mutation.getKnobName()) .detail("ConfigClass", mutation.getConfigClass())
.detail("KnobValue", mutation.getValue()); .detail("KnobName", mutation.getKnobName())
if (mutation.isSet()) { .detail("KnobValue", mutation.getValue());
reply.database[mutation.getKey()] = mutation.getValue(); if (mutation.isSet()) {
} else { reply.database[mutation.getKey()] = mutation.getValue();
reply.database.erase(mutation.getKey()); } else {
reply.database.erase(mutation.getKey());
}
} }
} }
req.reply.send(reply); req.reply.send(reply);
@ -89,7 +91,8 @@ class ConfigBroadcasterImpl {
ConfigFollowerGetChangesReply reply; ConfigFollowerGetChangesReply reply;
reply.mostRecentVersion = impl->mostRecentVersion; reply.mostRecentVersion = impl->mostRecentVersion;
for (const auto& versionedMutation : impl->versionedMutations) { for (const auto& versionedMutation : impl->versionedMutations) {
if (versionedMutation.version > req.lastSeenVersion) { if (versionedMutation.version > req.lastSeenVersion &&
req.configClassSet.contains(versionedMutation.mutation.getConfigClass())) {
TraceEvent(SevDebug, "BroadcasterSendingChangeMutation") TraceEvent(SevDebug, "BroadcasterSendingChangeMutation")
.detail("Version", versionedMutation.version) .detail("Version", versionedMutation.version)
.detail("ReqLastSeenVersion", req.lastSeenVersion) .detail("ReqLastSeenVersion", req.lastSeenVersion)

View File

@ -47,5 +47,10 @@ bool ConfigFollowerInterface::operator!=(ConfigFollowerInterface const& rhs) con
ConfigClassSet ConfigClassSet::fromParamString(std::string const& paramString) { ConfigClassSet ConfigClassSet::fromParamString(std::string const& paramString) {
// TODO: Validate input and implement // TODO: Validate input and implement
return {}; ConfigClassSet result;
return result;
}
bool ConfigClassSet::contains(KeyRef configClass) const {
return classes.count(configClass);
} }

View File

@ -36,6 +36,8 @@ public:
static ConfigClassSet fromParamString(std::string const& paramString); static ConfigClassSet fromParamString(std::string const& paramString);
bool contains(KeyRef configClass) const;
template <class Ar> template <class Ar>
void serialize(Ar& ar) { void serialize(Ar& ar) {
serializer(ar, classes); serializer(ar, classes);