public void AppendStatistics(StoreStatistics statistics)
 {
     using (
         var headerWriter =
             new BinaryWriter(_persistenceManager.GetOutputStream(GetStatisticsHeaderFile(), FileMode.Append)))
     {
         using (
             var recordWriter =
                 new StreamWriter(_persistenceManager.GetOutputStream(GetStatisticsLogFile(),
                                                                      FileMode.Append)))
         {
             var recordStart = recordWriter.BaseStream.Position;
             var record = new StoreStatisticsRecord(statistics.CommitNumber, statistics.TripleCount,
                                                    statistics.PredicateTripleCounts);
             var header = new StoreStatisticsHeaderRecord(statistics.CommitNumber, statistics.CommitTime,
                                                          recordStart);
             record.Save(recordWriter);
             header.Save(headerWriter);
             recordWriter.Flush();
             headerWriter.Flush();
             recordWriter.Close();
             headerWriter.Close();
         }
     }
 }
Exemple #2
0
 public void AppendStatistics(StoreStatistics statistics)
 {
     using (
         var headerWriter =
             new BinaryWriter(_persistenceManager.GetOutputStream(GetStatisticsHeaderFile(), FileMode.Append)))
     {
         using (
             var recordWriter =
                 new StreamWriter(_persistenceManager.GetOutputStream(GetStatisticsLogFile(),
                                                                      FileMode.Append)))
         {
             var recordStart = recordWriter.BaseStream.Position;
             var record      = new StoreStatisticsRecord(statistics.CommitNumber, statistics.TripleCount,
                                                         statistics.PredicateTripleCounts);
             var header = new StoreStatisticsHeaderRecord(statistics.CommitNumber, statistics.CommitTime,
                                                          recordStart);
             record.Save(recordWriter);
             header.Save(headerWriter);
             recordWriter.Flush();
             headerWriter.Flush();
             recordWriter.Close();
             headerWriter.Close();
         }
     }
 }
 public void Initialize(StoreStatistics lastStats, ulong lastCommitId, Action statsUpdateAction)
 {
     if (lastStats == null)
     {
         _jobCounter = 0;
         _lastStatsUpdateTime = DateTime.UtcNow;
     }
     else
     {
         _jobCounter = (int) (lastCommitId - lastStats.CommitNumber);
         _lastStatsUpdateTime = lastStats.CommitTime;
     }
     _statsUpdateAction = statsUpdateAction;
 }