OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """Storage attribute container identifier objects.""" | 2 """Storage attribute container identifier objects.""" |
3 | 3 |
4 from plaso.containers import interface as containers_interface | 4 from plaso.containers import interface as containers_interface |
5 | 5 |
6 | 6 |
| 7 class FakeIdentifier(containers_interface.AttributeContainerIdentifier): |
| 8 """Fake attribute container identifier intended for testing. |
| 9 |
| 10 Attributes: |
| 11 attribute_values_hash (int): hash value of the attribute values. |
| 12 """ |
| 13 |
| 14 def __init__(self, attribute_values_hash): |
| 15 """Initializes a fake attribute container identifier. |
| 16 |
| 17 Args: |
| 18 attribute_values_hash (int): hash value of the attribute values. |
| 19 """ |
| 20 super(FakeIdentifier, self).__init__() |
| 21 self.attribute_values_hash = attribute_values_hash |
| 22 |
| 23 def CopyToString(self): |
| 24 """Copies the identifier to a string representation. |
| 25 |
| 26 Returns: |
| 27 str: unique identifier or None. |
| 28 """ |
| 29 if self.attribute_values_hash is not None: |
| 30 return u'{0:d}'.format(self.attribute_values_hash) |
| 31 |
| 32 |
7 class SerializedStreamIdentifier( | 33 class SerializedStreamIdentifier( |
8 containers_interface.AttributeContainerIdentifier): | 34 containers_interface.AttributeContainerIdentifier): |
9 """Serialized stream attribute container identifier. | 35 """Serialized stream attribute container identifier. |
10 | 36 |
11 The identifier is used to uniquely identify attribute containers. Where | 37 The identifier is used to uniquely identify attribute containers. Where |
12 for example an attribute container is stored as a JSON serialized data in | 38 for example an attribute container is stored as a JSON serialized data in |
13 a ZIP file. | 39 a ZIP file. |
14 | 40 |
15 Attributes: | 41 Attributes: |
16 stream_number (int): number of the serialized attribute container stream. | 42 stream_number (int): number of the serialized attribute container stream. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 self.row_identifier = row_identifier | 88 self.row_identifier = row_identifier |
63 | 89 |
64 def CopyToString(self): | 90 def CopyToString(self): |
65 """Copies the identifier to a string representation. | 91 """Copies the identifier to a string representation. |
66 | 92 |
67 Returns: | 93 Returns: |
68 str: unique identifier or None. | 94 str: unique identifier or None. |
69 """ | 95 """ |
70 if self.name is not None and self.row_identifier is not None: | 96 if self.name is not None and self.row_identifier is not None: |
71 return u'{0:s}.{1:d}'.format(self.name, self.row_identifier) | 97 return u'{0:s}.{1:d}'.format(self.name, self.row_identifier) |
OLD | NEW |