Ejemplo n.º 1
0
        private static async Task <IndexValueModel> GetIndexRowForCondition(NeedleInHaystackColumnCondition condition, FileStream indexFile,
                                                                            IndexMetadataSectionModel relevantSection, long endOffset)
        {
            indexFile.Seek(relevantSection.Offset, SeekOrigin.Begin);
            var indexRows = indexFile.GetDeserializedRowsFromFileAsync <IndexValueModel>(endOffset);
            var indexRow  = await indexRows.FirstOrDefaultAsync(row => row.Value.Equals(condition.Value));

            return(indexRow);
        }
Ejemplo n.º 2
0
        private IEnumerable <IndexMetadataSectionModel> CreateMetadataFromRows(IList <FileRowMetadata> rowMetadatas)
        {
            var numOfRows = rowMetadatas.Count;

            for (var i = 0; i < numOfRows; i += _numOfRowsPerMetadataSection)
            {
                var currentRow      = rowMetadatas[i];
                var min             = currentRow.Value;
                var endRow          = Math.Min(i + _numOfRowsPerMetadataSection - 1, numOfRows - 1);
                var max             = rowMetadatas[endRow].Value;
                var offset          = currentRow.Offset;
                var metadataSection = new IndexMetadataSectionModel(min, max, offset);
                yield return(metadataSection);
            }
        }