in openr/py/openr/cli/commands/kvstore.py [0:0]
def compare(self, our_kvs, other_kvs, our_node, other_node):
"""print kv delta"""
print(
printing.caption_fmt(
"kv-compare between {} and {}".format(our_node, other_node)
)
)
# for comparing version and id info
our_kv_pub_db = {}
for key, value in our_kvs.items():
our_kv_pub_db[key] = (value.version, value.originatorId)
for key, value in sorted(our_kvs.items()):
other_val = other_kvs.get(key, None)
if other_val is None:
self.print_key_delta(key, our_node)
elif (
key.startswith(Consts.PREFIX_DB_MARKER)
or key.startswith(Consts.ADJ_DB_MARKER)
or other_val.value != value.value
):
self.print_db_delta(key, our_kv_pub_db, value, other_val)
for key, _ in sorted(other_kvs.items()):
ourVal = our_kvs.get(key, None)
if ourVal is None:
self.print_key_delta(key, other_node)