public virtual void coverage() { MapStream.empty().filter(e => false).distinct().sorted().sorted((e1, e2) => 0).peek(e => e.ToString()).limit(0).skip(0).sequential().parallel().unordered().onClose(() => Console.WriteLine()).close(); MapStream.empty().anyMatch(e => true); MapStream.empty().allMatch(e => true); MapStream.empty().noneMatch(e => true); MapStream.empty().count(); MapStream.empty().findAny(); MapStream.empty().findFirst(); MapStream.empty().max((e1, e2) => 0); MapStream.empty().min((e1, e2) => 0); MapStream.empty().GetEnumerator(); MapStream.empty().spliterator(); MapStream.empty().Parallel; MapStream.empty().map(e => e); MapStream.empty().mapToInt(e => 0); MapStream.empty().mapToLong(e => 0); MapStream.empty().mapToDouble(e => 0); MapStream.empty().flatMap(e => Stream.empty()); MapStream.empty().flatMapToDouble(e => DoubleStream.empty()); MapStream.empty().flatMapToInt(e => IntStream.empty()); MapStream.empty().flatMapToLong(e => LongStream.empty()); MapStream.empty().collect(toList()); MapStream.empty().collect(() => null, (o, e) => Console.WriteLine(), (o1, o2) => Console.WriteLine()); MapStream.empty().toArray(); MapStream.empty().toArray(i => new object[0]); MapStream.empty().forEach(e => Console.WriteLine()); MapStream.empty().forEachOrdered(e => Console.WriteLine()); MapStream.empty().reduce(new AbstractMap.SimpleEntry <>(null, null), (o1, o2) => null); MapStream.empty().reduce((o1, o2) => null); MapStream.empty().reduce(null, (o, e) => null, (o1, o2) => null); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") public static java.util.stream.LongStream toLongStream(Object list) public static LongStream ToLongStream(object list) { if (list == null) { return(LongStream.empty()); } else if (list is SequenceValue) { throw new System.ArgumentException("Need to implement support for SequenceValue in CompiledConversionUtils.toLongStream"); } else if (list is System.Collections.IList) { return(((System.Collections.IList)list).Select(n => (( Number )n).longValue())); } else if (list.GetType().IsAssignableFrom(typeof(object[]))) { return(java.util.( object[] )list.Select(n => (( Number )n).longValue())); } else if (list is sbyte[]) { sbyte[] array = ( sbyte[] )list; return(IntStream.range(0, array.Length).mapToLong(i => array[i])); } else if (list is short[]) { short[] array = ( short[] )list; return(IntStream.range(0, array.Length).mapToLong(i => array[i])); } else if (list is int[]) { return(IntStream.of(( int[] )list).mapToLong(i => i)); } else if (list is long[]) { return(LongStream.of(( long[] )list)); } //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new System.ArgumentException(format("Can not be converted to stream: %s", list.GetType().FullName)); }
public LongStream findLogVersionsToDelete(long upToLogVersion) { // Never delete anything. return(LongStream.empty()); }
public override LongStream FindLogVersionsToDelete(long upToVersion) { lock (this) { if (upToVersion == INITIAL_LOG_VERSION) { return(LongStream.empty()); } _threshold.init(); long upper = upToVersion - 1; bool exceeded = false; while (upper >= 0) { File file = _files.getLogFileForVersion(upper); if (!_fileSystem.fileExists(file)) { // There aren't logs to prune anything. Just return return(LongStream.empty()); } if (_fileSystem.getFileSize(file) > LOG_HEADER_SIZE && _threshold.reached(file, upper, _logFileInformation)) { exceeded = true; break; } upper--; } if (!exceeded) { return(LongStream.empty()); } // Find out which log is the earliest existing (lower bound to prune) long lower = upper; while (_fileSystem.fileExists(_files.getLogFileForVersion(lower - 1))) { lower--; } /* * Here we make sure that at least one historical log remains behind, in addition of course to the * current one. This is in order to make sure that at least one transaction remains always available for * serving to whomever asks for it. * To illustrate, imagine that there is a threshold in place configured so that it enforces pruning of the * log file that was just rotated out (for example, a file size threshold that is misconfigured to be smaller * than the smallest log). In such a case, until the database commits a transaction there will be no * transactions present on disk, making impossible to serve any to whichever client might ask, leading to * errors on both sides of the conversation. * This if statement does nothing more complicated than checking if the next-to-last log would be pruned * and simply skipping it if so. */ if (upper == upToVersion - 1) { upper--; } // The reason we delete from lower to upper is that if it crashes in the middle we can be sure that no holes // are created. // We create a closed range because we want to include the 'upper' log version as well. The check above ensures // we don't accidentally leave the database without any logs. return(LongStream.rangeClosed(lower, upper)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustNotHaveLogsFilesToPruneIfStrategyFindsNoFiles() public virtual void MustNotHaveLogsFilesToPruneIfStrategyFindsNoFiles() { when(_factory.strategyFromConfigValue(eq(_fs), eq(_logFiles), eq(_clock), anyString())).thenReturn(x => LongStream.empty()); LogPruning pruning = new LogPruningImpl(_fs, _logFiles, _logProvider, _factory, _clock, _config); assertFalse(pruning.MightHaveLogsToPrune()); }