Page MenuHomePhabricator
Paste P6852

phabricator 'compact' transaction phid storage
ActivePublic

Authored by mmodell on Mar 16 2018, 1:45 AM.
def compute_edge_phids_from_transactions(transactions, edgetype):
final_phids = {}
for trns in transactions:
try:
metadata = json.loads(trns[9])
if "edge:type" in metadata.keys() and metadata[
"edge:type"] is edgetype:
# removed phids:
phids = json.loads(trns[7])
for phid in phids:
final_phids.setdefault(phid, False)
# added phids:
phids = json.loads(trns[8])
for phid in phids:
final_phids.setdefault(phid, True)
except:
pass
return [key for key, val in final_phids.items() if val is True]