use of io.pravega.controller.store.stream.tables.StreamTruncationRecord in project pravega by pravega.
the class PersistentStreamBase method completeTruncation.
@Override
public CompletableFuture<Void> completeTruncation() {
return getTruncationData(true).thenCompose(truncationData -> {
Preconditions.checkNotNull(truncationData);
StreamProperty<StreamTruncationRecord> current = SerializationUtils.deserialize(truncationData.getData());
if (current.isUpdating()) {
StreamTruncationRecord truncationRecord = current.getProperty();
StreamProperty<StreamTruncationRecord> completedProp = StreamProperty.complete(truncationRecord.mergeDeleted());
return setTruncationData(new Data<>(SerializationUtils.serialize(completedProp), truncationData.getVersion()));
} else {
// idempotent
return CompletableFuture.completedFuture(null);
}
});
}
Aggregations