OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """Fake storage writer for testing.""" | 2 """Fake storage writer for testing.""" |
3 | 3 |
4 from __future__ import unicode_literals | 4 from __future__ import unicode_literals |
5 | 5 |
6 import copy | 6 import copy |
7 | 7 |
8 from plaso.lib import definitions | 8 from plaso.lib import definitions |
9 from plaso.storage import event_heaps | 9 from plaso.storage import event_heaps |
10 from plaso.storage import identifiers | 10 from plaso.storage import identifiers |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 # Make a copy of the event before adding the event data. | 346 # Make a copy of the event before adding the event data. |
347 event = copy.deepcopy(event) | 347 event = copy.deepcopy(event) |
348 # TODO: refactor this into psort. | 348 # TODO: refactor this into psort. |
349 self._ReadEventDataIntoEvent(event) | 349 self._ReadEventDataIntoEvent(event) |
350 | 350 |
351 event_heap.PushEvent(event) | 351 event_heap.PushEvent(event) |
352 | 352 |
353 return iter(event_heap.PopEvents()) | 353 return iter(event_heap.PopEvents()) |
354 | 354 |
| 355 def FinalizeProcessedTaskStorage(self, task): |
| 356 """Finalized a proccessed a task storage. |
| 357 |
| 358 Args: |
| 359 task (Task): task. |
| 360 |
| 361 Raises: |
| 362 IOError: if the task storage does not exist. |
| 363 """ |
| 364 if task.identifier not in self._task_storage_writers: |
| 365 raise IOError('Storage writer for task: {0:s} does not exist.'.format( |
| 366 task.identifier)) |
| 367 |
355 def Open(self): | 368 def Open(self): |
356 """Opens the storage writer. | 369 """Opens the storage writer. |
357 | 370 |
358 Raises: | 371 Raises: |
359 IOError: if the storage writer is already opened. | 372 IOError: if the storage writer is already opened. |
360 """ | 373 """ |
361 if self._is_open: | 374 if self._is_open: |
362 raise IOError('Storage writer already opened.') | 375 raise IOError('Storage writer already opened.') |
363 | 376 |
364 self._is_open = True | 377 self._is_open = True |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 # TODO: implement. | 415 # TODO: implement. |
403 | 416 |
404 def SetSerializersProfiler(self, serializers_profiler): | 417 def SetSerializersProfiler(self, serializers_profiler): |
405 """Sets the serializers profiler. | 418 """Sets the serializers profiler. |
406 | 419 |
407 Args: | 420 Args: |
408 serializers_profiler (SerializersProfiler): serializers profile. | 421 serializers_profiler (SerializersProfiler): serializers profile. |
409 """ | 422 """ |
410 pass | 423 pass |
411 | 424 |
| 425 def SetStorageProfiler(self, storage_profiler): |
| 426 """Sets the storage profiler. |
| 427 |
| 428 Args: |
| 429 storage_profiler (StorageProfiler): storage profiler. |
| 430 """ |
| 431 pass |
| 432 |
412 def WritePreprocessingInformation(self, unused_knowledge_base): | 433 def WritePreprocessingInformation(self, unused_knowledge_base): |
413 """Writes preprocessing information. | 434 """Writes preprocessing information. |
414 | 435 |
415 Args: | 436 Args: |
416 knowledge_base (KnowledgeBase): contains the preprocessing information. | 437 knowledge_base (KnowledgeBase): contains the preprocessing information. |
417 | 438 |
418 Raises: | 439 Raises: |
419 IOError: if the storage type does not support writing preprocessing | 440 IOError: if the storage type does not support writing preprocessing |
420 information or when the storage writer is closed. | 441 information or when the storage writer is closed. |
421 """ | 442 """ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 Raises: | 503 Raises: |
483 IOError: if the storage type does not support writing a task | 504 IOError: if the storage type does not support writing a task |
484 start or when the storage writer is closed. | 505 start or when the storage writer is closed. |
485 """ | 506 """ |
486 self._RaiseIfNotWritable() | 507 self._RaiseIfNotWritable() |
487 | 508 |
488 if self._storage_type != definitions.STORAGE_TYPE_TASK: | 509 if self._storage_type != definitions.STORAGE_TYPE_TASK: |
489 raise IOError('Task start not supported by storage type.') | 510 raise IOError('Task start not supported by storage type.') |
490 | 511 |
491 self.task_start = self._task.CreateTaskStart() | 512 self.task_start = self._task.CreateTaskStart() |
OLD | NEW |