private static bool ShouldWriteOriginalIndexBeforeUpdate(RootIndexRow currentIndexRow, RootIndexRow updateRow) { return(currentIndexRow != null && (string.Compare(currentIndexRow.ColumnName, updateRow.ColumnName, StringComparison.InvariantCulture) > 0 || (currentIndexRow.FileName != updateRow.FileName && string.CompareOrdinal(currentIndexRow.Min, updateRow.Min) < 0))); }
private async Task <RootIndexRow> AddUpdatedMetadataToFile(IList <FileRowMetadata> rowsMetadata, StreamWriter outputStreamWriter) { var metadataSections = CreateMetadataFromRows(rowsMetadata).ToList(); var minValue = metadataSections.First().Min; var maxValue = metadataSections.Last().Max; var rootIndexRow = new RootIndexRow(null, minValue, maxValue, null); foreach (var metadataSection in metadataSections) { await outputStreamWriter.WriteObjectToLineAsync(metadataSection); } return(rootIndexRow); }
private static async Task UpdateRowCacheInRedis(IDatabaseAsync db, RootIndexRow row) { var redisSetKey = GetRedisKeyForColumn(row.ColumnName); var redisFilesToValuesKey = GetRedisFilesToValuesKeyForColumn(row.ColumnName); var redisValuesToFilesKey = GetRedisValuesToFilesKeyForColumn(row.ColumnName); var currentMaxValue = await db.HashGetAsync(redisFilesToValuesKey, row.FileName); if (currentMaxValue != default) { await db.HashDeleteAsync(redisValuesToFilesKey, currentMaxValue); await db.SortedSetRemoveAsync(redisSetKey, currentMaxValue); } await db.HashSetAsync(redisValuesToFilesKey, row.FileName, row.Max); await db.HashSetAsync(redisValuesToFilesKey, row.Max, row.FileName); await db.SortedSetAddAsync(redisSetKey, row.Max, 0); }
private static bool ShouldWriteUpdateBeforeOriginalIndex(RootIndexRow currentIndexRow, RootIndexRow updateRow) { return(string.Compare(currentIndexRow.ColumnName, updateRow.ColumnName, StringComparison.InvariantCulture) < 0); }
private static bool ValidateRowWithRequest(string column, string val, RootIndexRow indexRow) { return(indexRow.ColumnName == column && string.CompareOrdinal(val, indexRow.Max) < 0); }