mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
Centralize identifier computation
This commit is contained in:
parent
a5aef627f8
commit
f05a5eecc2
@ -43,6 +43,11 @@ void RedisWriter::ConfigStaticInitialize()
|
|||||||
ConfigObject::OnVersionChanged.connect(std::bind(&RedisWriter::VersionChangedHandler, _1));
|
ConfigObject::OnVersionChanged.connect(std::bind(&RedisWriter::VersionChangedHandler, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline String GetIdentifier(const ConfigObject::Ptr& object)
|
||||||
|
{
|
||||||
|
return object->GetName();
|
||||||
|
}
|
||||||
|
|
||||||
void RedisWriter::UpdateAllConfigObjects(void)
|
void RedisWriter::UpdateAllConfigObjects(void)
|
||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
@ -149,8 +154,7 @@ void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool useTran
|
|||||||
Type::Ptr type = object->GetReflectionType();
|
Type::Ptr type = object->GetReflectionType();
|
||||||
|
|
||||||
String typeName = type->GetName().ToLower();
|
String typeName = type->GetName().ToLower();
|
||||||
//String objectKey = CalculateCheckSumString(object->GetName());
|
String objectKey = GetIdentifier(object);
|
||||||
String objectKey = object->GetName();
|
|
||||||
|
|
||||||
std::set<String> propertiesBlacklist ({"name", "__name", "package", "source_location", "templates"});
|
std::set<String> propertiesBlacklist ({"name", "__name", "package", "source_location", "templates"});
|
||||||
|
|
||||||
@ -229,8 +233,7 @@ void RedisWriter::SendConfigDelete(const ConfigObject::Ptr& object)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
String typeName = object->GetReflectionType()->GetName().ToLower();
|
String typeName = object->GetReflectionType()->GetName().ToLower();
|
||||||
//String objectKey = CalculateCheckSumString(object->GetName());
|
String objectKey = GetIdentifier(object);
|
||||||
String objectKey = object->GetName();
|
|
||||||
|
|
||||||
ExecuteQueries({
|
ExecuteQueries({
|
||||||
{ "DEL", "icinga:config:" + typeName + ":" + objectKey },
|
{ "DEL", "icinga:config:" + typeName + ":" + objectKey },
|
||||||
@ -339,11 +342,9 @@ void RedisWriter::UpdateObjectAttrs(const String& keyPrefix, const ConfigObject:
|
|||||||
Type::Ptr type = object->GetReflectionType();
|
Type::Ptr type = object->GetReflectionType();
|
||||||
|
|
||||||
String typeName = type->GetName().ToLower();
|
String typeName = type->GetName().ToLower();
|
||||||
String objectName = object->GetName();
|
|
||||||
|
|
||||||
/* Use the name checksum as unique key. */
|
/* Use the name checksum as unique key. */
|
||||||
//String objectKey = CalculateCheckSumString(object->GetName());
|
String objectKey = GetIdentifier(object);
|
||||||
String objectKey = object->GetName();
|
|
||||||
|
|
||||||
std::vector<std::vector<String> > queries;
|
std::vector<std::vector<String> > queries;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user