nodes: 0, module; 1, function_definition; 2, function_name:ProcessStorage; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, expression_statement; 20, expression_statement; 21, expression_statement; 22, if_statement; 23, if_statement; 24, if_statement; 25, expression_statement; 26, if_statement; 27, expression_statement; 28, expression_statement; 29, comment:"""Processes a plaso storage file.
  
      Raises:
        BadConfigOption: when a configuration parameter fails validation.
        RuntimeError: if a non-recoverable situation is encountered.
      """; 30, call; 31, call; 32, call; 33, assignment; 34, assignment; 35, assignment; 36, not_operator; 37, block; 38, assignment; 39, call; 40, assignment; 41, assignment; 42, assignment; 43, assignment; 44, assignment; 45, assignment; 46, attribute; 47, block; 48, comparison_operator:self._output_format != 'null'; 49, block; 50, attribute; 51, block; 52, call; 53, identifier:analysis_counter; 54, block; 55, assignment; 56, call; 57, attribute; 58, argument_list; 59, attribute; 60, argument_list; 61, attribute; 62, argument_list; 63, identifier:status_update_callback; 64, parenthesized_expression; 65, identifier:session; 66, call; 67, identifier:storage_reader; 68, call; 69, identifier:storage_reader; 70, expression_statement; 71, return_statement; 72, attribute; 73, parenthesized_expression; 74, attribute; 75, argument_list; 76, identifier:configuration; 77, call; 78, attribute; 79, attribute; 80, attribute; 81, attribute; 82, attribute; 83, attribute; 84, attribute; 85, attribute; 86, identifier:analysis_counter; 87, None; 88, identifier:self; 89, identifier:_analysis_plugins; 90, expression_statement; 91, comment:# TODO: add single processing support.; 92, expression_statement; 93, expression_statement; 94, expression_statement; 95, for_statement; 96, attribute; 97, string; 98, expression_statement; 99, comment:# TODO: add single processing support.; 100, expression_statement; 101, expression_statement; 102, identifier:self; 103, identifier:_quiet_mode; 104, return_statement; 105, attribute; 106, argument_list; 107, expression_statement; 108, for_statement; 109, expression_statement; 110, expression_statement; 111, identifier:storage_reader; 112, call; 113, attribute; 114, argument_list; 115, identifier:self; 116, identifier:_CheckStorageFile; 117, attribute; 118, attribute; 119, identifier:SetMode; 120, attribute; 121, attribute; 122, identifier:SetStorageFileInformation; 123, attribute; 124, call; 125, attribute; 126, argument_list; 127, attribute; 128, argument_list; 129, call; 130, identifier:self; 131, identifier:_number_of_analysis_reports; 132, call; 133, identifier:storage_reader; 134, identifier:Close; 135, attribute; 136, argument_list; 137, identifier:configuration; 138, identifier:data_location; 139, identifier:self; 140, identifier:_data_location; 141, attribute; 142, identifier:directory; 143, identifier:self; 144, identifier:_profiling_directory; 145, attribute; 146, identifier:sample_rate; 147, identifier:self; 148, identifier:_profiling_sample_rate; 149, attribute; 150, identifier:profilers; 151, identifier:self; 152, identifier:_profilers; 153, assignment; 154, assignment; 155, call; 156, assignment; 157, pattern_list; 158, call; 159, block; 160, identifier:self; 161, identifier:_output_format; 162, string_content:null; 163, assignment; 164, assignment; 165, call; 166, attribute; 167, identifier:Write; 168, string; 169, assignment; 170, pattern_list; 171, call; 172, block; 173, call; 174, call; 175, attribute; 176, argument_list; 177, identifier:self; 178, identifier:_PrintAnalysisReportsDetails; 179, identifier:storage_reader; 180, identifier:self; 181, identifier:_storage_file_path; 182, identifier:self; 183, identifier:_status_view; 184, identifier:self; 185, identifier:_status_view_mode; 186, identifier:self; 187, identifier:_status_view; 188, identifier:self; 189, identifier:_storage_file_path; 190, attribute; 191, argument_list; 192, attribute; 193, identifier:CreateSession; 194, keyword_argument; 195, keyword_argument; 196, attribute; 197, identifier:CreateStorageReaderForFile; 198, attribute; 199, attribute; 200, argument_list; 201, attribute; 202, argument_list; 203, identifier:configurations; 204, identifier:ProcessingConfiguration; 205, identifier:configuration; 206, identifier:profiling; 207, identifier:configuration; 208, identifier:profiling; 209, identifier:configuration; 210, identifier:profiling; 211, identifier:storage_writer; 212, parenthesized_expression; 213, identifier:analysis_engine; 214, call; 215, attribute; 216, argument_list; 217, identifier:analysis_counter; 218, call; 219, identifier:item; 220, identifier:value; 221, identifier:iter; 222, argument_list; 223, expression_statement; 224, identifier:storage_reader; 225, parenthesized_expression; 226, identifier:analysis_engine; 227, call; 228, attribute; 229, argument_list; 230, identifier:self; 231, identifier:_output_writer; 232, string_content; 233, identifier:table_view; 234, call; 235, identifier:element; 236, identifier:count; 237, attribute; 238, argument_list; 239, if_statement; 240, attribute; 241, argument_list; 242, attribute; 243, argument_list; 244, attribute; 245, identifier:CreateStorageReaderForFile; 246, attribute; 247, attribute; 248, identifier:GetAnalysisStatusUpdateCallback; 249, identifier:engine; 250, identifier:BaseEngine; 251, identifier:command_line_arguments; 252, attribute; 253, identifier:preferred_encoding; 254, attribute; 255, identifier:storage_factory; 256, identifier:StorageFactory; 257, identifier:self; 258, identifier:_storage_file_path; 259, identifier:logger; 260, identifier:error; 261, call; 262, identifier:storage_reader; 263, identifier:GetNumberOfAnalysisReports; 264, call; 265, attribute; 266, argument_list; 267, identifier:analysis_engine; 268, identifier:AnalyzeEvents; 269, attribute; 270, identifier:storage_writer; 271, attribute; 272, attribute; 273, identifier:configuration; 274, keyword_argument; 275, keyword_argument; 276, keyword_argument; 277, keyword_argument; 278, attribute; 279, argument_list; 280, call; 281, assignment; 282, call; 283, attribute; 284, argument_list; 285, identifier:analysis_engine; 286, identifier:ExportEvents; 287, attribute; 288, identifier:storage_reader; 289, attribute; 290, identifier:configuration; 291, keyword_argument; 292, keyword_argument; 293, keyword_argument; 294, keyword_argument; 295, keyword_argument; 296, escape_sequence:\n; 297, attribute; 298, argument_list; 299, identifier:analysis_counter; 300, identifier:most_common; 301, comparison_operator:element != 'total'; 302, block; 303, identifier:table_view; 304, identifier:AddRow; 305, list; 306, identifier:table_view; 307, identifier:Write; 308, attribute; 309, identifier:storage_factory; 310, identifier:StorageFactory; 311, identifier:self; 312, identifier:_storage_file_path; 313, identifier:self; 314, identifier:_status_view; 315, identifier:self; 316, identifier:_command_line_arguments; 317, identifier:self; 318, identifier:preferred_encoding; 319, attribute; 320, argument_list; 321, attribute; 322, argument_list; 323, identifier:psort; 324, identifier:PsortMultiProcessEngine; 325, keyword_argument; 326, identifier:self; 327, identifier:_knowledge_base; 328, identifier:self; 329, identifier:_data_location; 330, identifier:self; 331, identifier:_analysis_plugins; 332, identifier:event_filter; 333, attribute; 334, identifier:event_filter_expression; 335, attribute; 336, identifier:status_update_callback; 337, identifier:status_update_callback; 338, identifier:worker_memory_limit; 339, attribute; 340, identifier:collections; 341, identifier:Counter; 342, attribute; 343, argument_list; 344, subscript; 345, identifier:value; 346, attribute; 347, argument_list; 348, identifier:psort; 349, identifier:PsortMultiProcessEngine; 350, keyword_argument; 351, identifier:self; 352, identifier:_knowledge_base; 353, identifier:self; 354, identifier:_output_module; 355, identifier:deduplicate_events; 356, attribute; 357, identifier:event_filter; 358, attribute; 359, identifier:status_update_callback; 360, identifier:status_update_callback; 361, identifier:time_slice; 362, attribute; 363, identifier:use_time_slicer; 364, attribute; 365, attribute; 366, identifier:GetTableView; 367, attribute; 368, keyword_argument; 369, identifier:element; 370, string; 371, expression_statement; 372, string; 373, subscript; 374, identifier:self; 375, identifier:_output_writer; 376, string; 377, identifier:format; 378, attribute; 379, attribute; 380, identifier:CreateStorageWriterForFile; 381, identifier:session; 382, attribute; 383, identifier:use_zeromq; 384, attribute; 385, identifier:self; 386, identifier:_event_filter; 387, identifier:self; 388, identifier:_event_filter_expression; 389, identifier:self; 390, identifier:_worker_memory_limit; 391, attribute; 392, identifier:items; 393, identifier:analysis_counter; 394, identifier:item; 395, attribute; 396, identifier:CreateStorageReaderForFile; 397, attribute; 398, identifier:use_zeromq; 399, attribute; 400, identifier:self; 401, identifier:_deduplicate_events; 402, identifier:self; 403, identifier:_event_filter; 404, identifier:self; 405, identifier:_time_slice; 406, identifier:self; 407, identifier:_use_time_slicer; 408, identifier:views; 409, identifier:ViewsFactory; 410, identifier:self; 411, identifier:_views_format_type; 412, identifier:title; 413, string; 414, string_content:total; 415, call; 416, string_content:Total; 417, identifier:analysis_counter; 418, string; 419, string_content:Format of storage file: {0:s} not supported; 420, identifier:self; 421, identifier:_storage_file_path; 422, identifier:storage_factory; 423, identifier:StorageFactory; 424, identifier:self; 425, identifier:_storage_file_path; 426, identifier:self; 427, identifier:_use_zeromq; 428, identifier:session; 429, identifier:analysis_reports_counter; 430, identifier:storage_factory; 431, identifier:StorageFactory; 432, identifier:self; 433, identifier:_storage_file_path; 434, identifier:self; 435, identifier:_use_zeromq; 436, string_content:Analysis reports generated; 437, attribute; 438, argument_list; 439, string_content:total; 440, identifier:table_view; 441, identifier:AddRow; 442, list; 443, identifier:element; 444, identifier:count
code: def ProcessStorage(self):
      """Processes a plaso storage file.
  
      Raises:
        BadConfigOption: when a configuration parameter fails validation.
        RuntimeError: if a non-recoverable situation is encountered.
      """
      self._CheckStorageFile(self._storage_file_path)
  
      self._status_view.SetMode(self._status_view_mode)
      self._status_view.SetStorageFileInformation(self._storage_file_path)
  
      status_update_callback = (
          self._status_view.GetAnalysisStatusUpdateCallback())
  
      session = engine.BaseEngine.CreateSession(
          command_line_arguments=self._command_line_arguments,
          preferred_encoding=self.preferred_encoding)
  
      storage_reader = storage_factory.StorageFactory.CreateStorageReaderForFile(
          self._storage_file_path)
      if not storage_reader:
        logger.error('Format of storage file: {0:s} not supported'.format(
            self._storage_file_path))
        return
  
      self._number_of_analysis_reports = (
          storage_reader.GetNumberOfAnalysisReports())
      storage_reader.Close()
  
      configuration = configurations.ProcessingConfiguration()
      configuration.data_location = self._data_location
      configuration.profiling.directory = self._profiling_directory
      configuration.profiling.sample_rate = self._profiling_sample_rate
      configuration.profiling.profilers = self._profilers
  
      analysis_counter = None
      if self._analysis_plugins:
        storage_writer = (
            storage_factory.StorageFactory.CreateStorageWriterForFile(
                session, self._storage_file_path))
  
        # TODO: add single processing support.
        analysis_engine = psort.PsortMultiProcessEngine(
            use_zeromq=self._use_zeromq)
  
        analysis_engine.AnalyzeEvents(
            self._knowledge_base, storage_writer, self._data_location,
            self._analysis_plugins, configuration,
            event_filter=self._event_filter,
            event_filter_expression=self._event_filter_expression,
            status_update_callback=status_update_callback,
            worker_memory_limit=self._worker_memory_limit)
  
        analysis_counter = collections.Counter()
        for item, value in iter(session.analysis_reports_counter.items()):
          analysis_counter[item] = value
  
      if self._output_format != 'null':
        storage_reader = (
            storage_factory.StorageFactory.CreateStorageReaderForFile(
                self._storage_file_path))
  
        # TODO: add single processing support.
        analysis_engine = psort.PsortMultiProcessEngine(
            use_zeromq=self._use_zeromq)
  
        analysis_engine.ExportEvents(
            self._knowledge_base, storage_reader, self._output_module,
            configuration, deduplicate_events=self._deduplicate_events,
            event_filter=self._event_filter,
            status_update_callback=status_update_callback,
            time_slice=self._time_slice, use_time_slicer=self._use_time_slicer)
  
      if self._quiet_mode:
        return
  
      self._output_writer.Write('Processing completed.\n')
  
      if analysis_counter:
        table_view = views.ViewsFactory.GetTableView(
            self._views_format_type, title='Analysis reports generated')
        for element, count in analysis_counter.most_common():
          if element != 'total':
            table_view.AddRow([element, count])
  
        table_view.AddRow(['Total', analysis_counter['total']])
        table_view.Write(self._output_writer)
  
      storage_reader = storage_factory.StorageFactory.CreateStorageReaderForFile(
          self._storage_file_path)
      self._PrintAnalysisReportsDetails(storage_reader)