Beispiel #1
0
        /// <inheritdoc />
        public void Fill <T>(IColumnDescriptor <T> column, T value, int destinationIndex, int length)
        {
            if (!_columns.Contains(column))
            {
                throw new NoSuchColumnException(column);
            }

            _inner.Fill(column, value, destinationIndex, length);
        }
Beispiel #2
0
        private bool TryGetEntriesContiguous(LogSourceSection sourceSection, ILogBuffer destination, int destinationIndex, out IReadOnlyList <LogSourceSection> accessedPageBoundaries)
        {
            bool fullyRead                 = true;
            var  sourceSectionEndIndex     = Math.Min((int)(sourceSection.Index + sourceSection.Count), _sourceCount);
            var  numEntriesRead            = 0;
            var  tmpAccessedPageBoundaries = new List <LogSourceSection>();

            for (LogLineIndex i = sourceSection.Index; i < sourceSectionEndIndex;)
            {
                var pageIndex          = GetPageIndex(i);
                var remainingPageCount = (pageIndex + 1) * _pageSize - i;
                var count = Math.Min(remainingPageCount, sourceSectionEndIndex - i);

                var page = TryGetPage(pageIndex);
                if (page != null)
                {
                    fullyRead &= page.TryRead(i, count, destination, destinationIndex + numEntriesRead, fullyRead);
                    tmpAccessedPageBoundaries.Add(page.Section);
                }
                else
                {
                    destination.FillDefault(destinationIndex + numEntriesRead, count);
                    if (destination.Contains(PageBufferedLogSource.RetrievalState))
                    {
                        destination.Fill(PageBufferedLogSource.RetrievalState, RetrievalState.NotCached, destinationIndex + numEntriesRead, count);
                    }
                    fullyRead = false;
                    tmpAccessedPageBoundaries.Add(GetSectionForPage(pageIndex));
                }

                numEntriesRead += count;
                i += count;
            }

            if (numEntriesRead < sourceSection.Count)
            {
                var start = destinationIndex + numEntriesRead;
                destination.FillDefault(start, sourceSection.Count - numEntriesRead);
                fullyRead = false;
            }

            accessedPageBoundaries = tmpAccessedPageBoundaries;
            return(fullyRead);
        }
Beispiel #3
0
        private bool TryGetEntriesSegmented(IReadOnlyList <LogLineIndex> sourceIndices, ILogBuffer destination, int destinationStartIndex, out IReadOnlyList <LogSourceSection> accessedPageBoundaries)
        {
            var tmpAccessedPageBoundaries = new List <LogSourceSection>();

            bool fullyRead = true;

            for (int i = 0; i < sourceIndices.Count; ++i)
            {
                var sourceIndex      = sourceIndices[i];
                var destinationIndex = destinationStartIndex + i;
                if (sourceIndex.IsValid)
                {
                    var pageIndex = GetPageIndex(sourceIndex);
                    var page      = TryGetPage(pageIndex);
                    if (page != null)
                    {
                        fullyRead &= page.TryRead(sourceIndex, 1, destination, destinationIndex, fullyRead);
                        tmpAccessedPageBoundaries.Add(page.Section);
                    }
                    else
                    {
                        destination.FillDefault(destinationIndex, 1);
                        if (destination.Contains(PageBufferedLogSource.RetrievalState))
                        {
                            var state = sourceIndex >= _sourceCount
                                                                ? RetrievalState.NotInSource
                                                                : RetrievalState.NotCached;
                            destination.Fill(PageBufferedLogSource.RetrievalState, state, destinationIndex, 1);
                        }
                        fullyRead = false;
                        tmpAccessedPageBoundaries.Add(GetSectionForPage(pageIndex));
                    }
                }
                else
                {
                    destination.FillDefault(destinationIndex, 1);
                }
            }

            accessedPageBoundaries = tmpAccessedPageBoundaries;
            return(fullyRead);
        }