use of io.pravega.segmentstore.server.WriterFlushResult in project pravega by pravega.
the class WriterTableProcessor method flush.
@Override
public CompletableFuture<WriterFlushResult> flush(boolean force, Duration timeout) {
Exceptions.checkNotClosed(this.closed.get(), this);
if (!force && !mustFlush()) {
return CompletableFuture.completedFuture(new WriterFlushResult());
}
TimeoutTimer timer = new TimeoutTimer(timeout);
return this.connector.getSegment(timer.getRemaining()).thenComposeAsync(segment -> flushWithSingleRetry(segment, timer).thenComposeAsync(flushResult -> {
flushComplete(flushResult);
return compactIfNeeded(segment, flushResult.highestCopiedOffset, timer).thenApply(v -> flushResult);
}, this.executor), this.executor);
}
Aggregations