RedisWriter: dump also environment_checksum (per config object)

This commit is contained in:
Alexander A. Klimov 2018-06-22 16:18:22 +02:00 committed by Michael Friedrich
parent 4eee9572ab
commit 724ce1f172
3 changed files with 8 additions and 1 deletions

View File

@ -155,6 +155,7 @@ void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool useTran
Dictionary::Ptr checkSums = new Dictionary();
checkSums->Set("name_checksum", CalculateCheckSumString(object->GetShortName()));
checkSums->Set("environment_checksum", CalculateCheckSumString(GetEnvironment()));
// TODO: move this elsewhere
Checkable::Ptr checkable = dynamic_pointer_cast<Checkable>(object);

View File

@ -41,9 +41,14 @@ String RedisWriter::FormatCheckSumBinary(const String& str)
static Value l_DefaultEnv = "production";
String RedisWriter::GetEnvironment()
{
return ScriptGlobal::Get("Environment", &l_DefaultEnv);
}
String RedisWriter::GetIdentifier(const ConfigObject::Ptr& object)
{
return HashValue((Array::Ptr)new Array({ScriptGlobal::Get("Environment", &l_DefaultEnv), object->GetName()}));
return HashValue((Array::Ptr)new Array({GetEnvironment(), object->GetName()}));
}
String RedisWriter::CalculateCheckSumString(const String& str)

View File

@ -78,6 +78,7 @@ private:
static String FormatCheckSumBinary(const String& str);
static String GetIdentifier(const ConfigObject::Ptr& object);
static String GetEnvironment();
static String CalculateCheckSumString(const String& str);
static String CalculateCheckSumGroups(const Array::Ptr& groups);
static String CalculateCheckSumProperties(const ConfigObject::Ptr& object, const std::set<String>& propertiesBlacklist);