OLD | NEW |
1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 """stream.StreamEngine implementation for LogDog, using Milo annotation | 5 """stream.StreamEngine implementation for LogDog, using Milo annotation |
6 protobuf. | 6 protobuf. |
7 """ | 7 """ |
8 | 8 |
9 import collections | 9 import collections |
10 import contextlib | |
11 import copy | 10 import copy |
12 import datetime | 11 import datetime |
13 import functools | 12 import functools |
14 import itertools | |
15 import os | 13 import os |
16 import threading | 14 import threading |
17 import sys | 15 import sys |
18 | 16 |
19 from . import env | 17 from . import env |
20 from . import stream | 18 from . import stream |
21 from . import util | |
22 | 19 |
23 import google.protobuf.message | |
24 import google.protobuf.timestamp_pb2 as timestamp_pb2 | |
25 import libs.logdog.bootstrap | 20 import libs.logdog.bootstrap |
26 import libs.logdog.stream | 21 import libs.logdog.stream |
27 import libs.logdog.streamname | 22 import libs.logdog.streamname |
28 import annotations_pb2 as pb | 23 import annotations_pb2 as pb |
29 | 24 |
30 | 25 |
31 # The datetime for the epoch. | 26 # The datetime for the epoch. |
32 _EPOCH = datetime.datetime.utcfromtimestamp(0) | 27 _EPOCH = datetime.datetime.utcfromtimestamp(0) |
33 | 28 |
34 # The annotation stream ContentType. | 29 # The annotation stream ContentType. |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 return v.replace('/', '_') | 806 return v.replace('/', '_') |
812 | 807 |
813 @staticmethod | 808 @staticmethod |
814 def _normalize(v): | 809 def _normalize(v): |
815 return libs.logdog.streamname.normalize(v, prefix='s_') | 810 return libs.logdog.streamname.normalize(v, prefix='s_') |
816 | 811 |
817 def __str__(self): | 812 def __str__(self): |
818 if not self._base: | 813 if not self._base: |
819 raise ValueError('Cannot generate string from empty StreamName.') | 814 raise ValueError('Cannot generate string from empty StreamName.') |
820 return self._base | 815 return self._base |
OLD | NEW |