|
|
@ -21,6 +21,7 @@ class StreamLogClient():
|
|
|
|
|
|
|
|
|
|
|
|
def write_value(self, row_id, key, value):
|
|
|
|
def write_value(self, row_id, key, value):
|
|
|
|
"""Write key=value for the given row, or delete if value=None"""
|
|
|
|
"""Write key=value for the given row, or delete if value=None"""
|
|
|
|
|
|
|
|
logging.debug("Write to streamlog {} {} = {!r}".format(row_id, key, value))
|
|
|
|
if value is None:
|
|
|
|
if value is None:
|
|
|
|
return self.request("DELETE", "entry", row_id, key)
|
|
|
|
return self.request("DELETE", "entry", row_id, key)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -63,10 +64,7 @@ class StreamLogMiddleware:
|
|
|
|
# Omitted columns act as the identity function.
|
|
|
|
# Omitted columns act as the identity function.
|
|
|
|
self.column_decode = {
|
|
|
|
self.column_decode = {
|
|
|
|
'event_start': parse_utc_only,
|
|
|
|
'event_start': parse_utc_only,
|
|
|
|
# New, to switch to.
|
|
|
|
'event_end': lambda v: parse_utc_only(v["time"]) if v["type"] == "Time" else None,
|
|
|
|
# 'event_end': lambda v: parse_utc_only(v["time"]) if v["type"] == "Time" else None,
|
|
|
|
|
|
|
|
# Old
|
|
|
|
|
|
|
|
'event_end': lambda v: None if v is None else parse_utc_only(v),
|
|
|
|
|
|
|
|
'category': lambda v: v["name"],
|
|
|
|
'category': lambda v: v["name"],
|
|
|
|
'state': lambda v: None if v is None else v.upper(),
|
|
|
|
'state': lambda v: None if v is None else v.upper(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|