Пример #1
0
 void ILogSourcesManagerInternal.OnSourceStatsChanged(ILogSource logSource, LogProviderStatsFlag flags)
 {
     if (OnLogSourceStatsChanged != null)
     {
         OnLogSourceStatsChanged(logSource, new LogSourceStatsEventArgs()
         {
             flags = flags
         });
     }
 }
Пример #2
0
 void ILogProviderHost.OnStatisticsChanged(LogProviderStatsFlag flags)
 {
 }
Пример #3
0
        bool UpdateAvailableTime(bool incrementalMode)
        {
            bool itIsFirstUpdate = firstUpdateFlag;

            firstUpdateFlag = false;

            UpdateBoundsStatus status = reader.UpdateAvailableBounds(incrementalMode);

            if (status == UpdateBoundsStatus.NothingUpdated && incrementalMode)
            {
                return(false);
            }

            if (status == UpdateBoundsStatus.OldMessagesAreInvalid)
            {
                incrementalMode = false;
            }

            // Get new boundary values into temporary variables
            IMessage newFirst, newLast;

            PositionedMessagesUtils.GetBoundaryMessages(reader, null, out newFirst, out newLast);

            if (firstMessage != null)
            {
                if (newFirst == null || MessageTimestamp.Compare(newFirst.Time, firstMessage.Time) != 0)
                {
                    // The first message we've just read differs from the cached one.
                    // This means that the log was overwritten. Fall to non-incremental mode.
                    incrementalMode = false;
                }
            }

            if (!incrementalMode)
            {
                if (!itIsFirstUpdate)
                {
                    // Reset everything that has been loaded so far
                    InvalidateEverythingThatHasBeenLoaded();
                }
                firstMessage = null;
            }

            // Try to get the dates range for new bounday messages
            DateRange newAvailTime = GetAvailableDateRangeHelper(newFirst, newLast);

            firstMessage = newFirst;

            // Getting here means that the boundaries changed.
            // Fire the notfication.

            var positionsRange = new FileRange.Range(reader.BeginPosition, reader.EndPosition);

            if (!incrementalMode)
            {
                readerContentsEtag = reader.GetContentsEtag();
            }

            int contentsEtag =
                readerContentsEtag
                ^ positionsRange.Begin.GetHashCode()
                ^ positionsRange.End.GetHashCode();

            StatsTransaction(stats =>
            {
                stats.AvailableTime    = newAvailTime;
                LogProviderStatsFlag f = LogProviderStatsFlag.AvailableTime;
                if (incrementalMode)
                {
                    f |= LogProviderStatsFlag.AvailableTimeUpdatedIncrementallyFlag;
                }
                stats.TotalBytes = reader.SizeInBytes;
                f |= LogProviderStatsFlag.BytesCount;
                stats.PositionsRange = positionsRange;
                f |= LogProviderStatsFlag.PositionsRange;
                stats.PositionsRangeUpdatesCount++;
                if (stats.ContentsEtag == null || contentsEtag != stats.ContentsEtag.Value)
                {
                    stats.ContentsEtag = contentsEtag;
                    f |= LogProviderStatsFlag.ContentsEtag;
                }
                return(f);
            });

            return(true);
        }
Пример #4
0
 void ILogSourcesManagerInternal.OnSourceStatsChanged(
     ILogSource logSource, LogProviderStats value, LogProviderStats oldValue, LogProviderStatsFlag flags)
 {
     OnLogSourceStatsChanged?.Invoke(logSource, new LogSourceStatsEventArgs(value, oldValue, flags));
 }
Пример #5
0
 void ILogProviderHost.OnStatisticsChanged(
     LogProviderStats value, LogProviderStats oldValue, LogProviderStatsFlag flags)
 {
 }
Пример #6
0
 void ILogProviderHost.OnStatisticsChanged(LogProviderStats value,
                                           LogProviderStats oldValue, LogProviderStatsFlag flags)
 {
     owner.OnSourceStatsChanged(this, value, oldValue, flags);
 }
Пример #7
0
 public void OnStatisticsChanged(LogProviderStatsFlag flags)
 {
     owner.OnSourceStatsChanged(this, flags);
 }
Пример #8
0
 public LogSourceStatsEventArgs(LogProviderStats value, LogProviderStats oldValue, LogProviderStatsFlag flags)
 {
     this.Value    = value;
     this.OldValue = oldValue;
     this.Flags    = flags;
 }