Revert "Upgrade event flag collapsing to support all flag changes."

This reverts commit dadf3852f2ca7aaa85fb97b3d265c990b4e5a38a.

(imported from commit de5a95572aa955b4a9419b80a99d2446c51730e7)
This commit is contained in:
Tim Abbott
2013-11-28 11:44:58 -05:00
committed by Steve Howell
parent 10bce7ffe8
commit 2c2f404cb6
2 changed files with 9 additions and 30 deletions

View File

@@ -148,10 +148,13 @@ def compute_full_event_type(event):
if event["type"] == "update_message_flags":
if event["all"]:
# Put the "all" case in its own category
return "all_flags/%s/%s" % (event["flag"], event["operation"])
return "flags/%s/%s" % (event["operation"], event["flag"])
return "%s/%s/all" % (event["flag"], event["operation"])
return "%s/%s" % (event["flag"], event["operation"])
return event["type"]
# Virtual events are a mechanism for storing pointer changes and other
# easily collapsed event types efficiently.
VIRTUAL_EVENT_TYPES = ["pointer", "read/add", "restart"]
class EventQueue(object):
def __init__(self, id):
self.queue = deque()
@@ -177,8 +180,7 @@ class EventQueue(object):
event['id'] = self.next_event_id
self.next_event_id += 1
full_event_type = compute_full_event_type(event)
if (full_event_type in ["pointer", "restart"] or
full_event_type.startswith("flags/")):
if full_event_type in VIRTUAL_EVENT_TYPES:
if full_event_type not in self.virtual_events:
self.virtual_events[full_event_type] = copy.deepcopy(event)
return
@@ -189,10 +191,10 @@ class EventQueue(object):
virtual_event["timestamp"] = event["timestamp"]
if full_event_type == "pointer":
virtual_event["pointer"] = event["pointer"]
elif full_event_type == "read/add":
virtual_event["messages"] += event["messages"]
elif full_event_type == "restart":
virtual_event["server_generation"] = event["server_generation"]
elif full_event_type.startswith("flags/"):
virtual_event["messages"] += event["messages"]
else:
self.queue.append(event)