Пример #1
0
 private void GetRawContent(IReadOnlyList <LogLineIndex> indices, string[] destination, int destinationIndex)
 {
     lock (_syncRoot)
     {
         _entries.CopyTo(Core.Columns.RawContent, indices, destination, destinationIndex);
     }
 }
Пример #2
0
        /// <inheritdoc />
        public void GetColumn <T>(LogSourceSection sourceSection, IColumnDescriptor <T> column, T[] destination, int destinationIndex, LogSourceQueryOptions queryOptions)
        {
            if (column == null)
            {
                throw new ArgumentNullException(nameof(column));
            }
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }
            if (destinationIndex < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(destinationIndex));
            }

            _logBuffer.CopyTo(column, (int)sourceSection.Index, destination, destinationIndex, sourceSection.Count);
        }
Пример #3
0
 public override void GetColumn <T>(IReadOnlyList <LogLineIndex> sourceIndices,
                                    IColumnDescriptor <T> column,
                                    T[] destination,
                                    int destinationIndex,
                                    LogSourceQueryOptions queryOptions)
 {
     lock (_syncRoot)
     {
         if (Equals(column, PageBufferedLogSource.RetrievalState))
         {
             var dest = (RetrievalState[])(object)destination;
             if (sourceIndices is LogSourceSection section)
             {
                 var totalCount = (int)(section.Index + section.Count);
                 var fillCount  = Math.Min(totalCount, _buffer.Count);
                 dest.Fill(RetrievalState.Retrieved, destinationIndex, fillCount);
                 if (totalCount > fillCount)
                 {
                     dest.Fill(RetrievalState.NotInSource, fillCount, totalCount - fillCount);
                 }
             }
             else
             {
                 for (int i = 0; i < sourceIndices.Count; ++i)
                 {
                     var index = sourceIndices[i];
                     dest[destinationIndex + i] = index < _buffer.Count
                                                         ? RetrievalState.Retrieved
                                                         : RetrievalState.NotInSource;
                 }
             }
         }
         else
         {
             _buffer.CopyTo(column, new Int32View(sourceIndices), destination, destinationIndex);
         }
     }
 }
Пример #4
0
            private long[] GetLineOffsets(LogBufferList index)
            {
                // We need to find out where to reposition the file stream.
                // For a non-contiguous read-request, we'll have to look up
                // the offset for every requested line since it might jump all over the place.
                var indices = new long[_sourceIndices.Length];

                lock (index)
                {
                    index.CopyTo(StreamingTextLogSource.LineOffsetInBytes, _sourceIndices, indices, 0);
                }

                return(indices);
            }
Пример #5
0
            private long GetFirstLineOffset(LogBufferList index)
            {
                // We need to find out where to reposition the file stream.
                // This is super easy for contiguous read-requests: All we have to do is
                // to find the offset of the first requested line and then read from there...
                var indices = new long[1];

                lock (index)
                {
                    index.CopyTo(StreamingTextLogSource.LineOffsetInBytes, new LogSourceSection(_sourceSection.Index, 1), indices, 0);
                }

                return(indices[0]);
            }