Merge Algorithm¶
This algorithm is an integral piece of composability in ASAB Maestro.
ASAB Maestro composes various artifacts into a site configuration. In examples:
- You can override descriptor in the model
- Generated configuration of Elasticsearch is provided to each configuration file of each ASAB microservice.
Every declaration or configuration can be transformed into an object (or Python dictionary) or an array (or Python list) or their combination.
The merge algorithm takes two objects (dictionaries) signed with preference. One object is always "more important". When the objects start merging together, their content is compared. If their content is completely different, the resulting object contains all the information from both of them. When there's a conflict, both the objects contain the same key, only the value from the "more important" object is taken into the result. If two arrays are compared, the result is the sum of the arrays (lists).