use of io.pravega.controller.store.stream.records.RetentionSet in project pravega by pravega.
the class ControllerMetadataJsonSerializerTest method testRetentionSet.
@Test
public void testRetentionSet() {
StreamCutReferenceRecord refRecord1 = StreamCutReferenceRecord.builder().recordingSize(0L).recordingTime(10L).build();
StreamCutReferenceRecord refRecord2 = StreamCutReferenceRecord.builder().recordingSize(1L).recordingTime(11L).build();
RetentionSet record = new RetentionSet(ImmutableList.of(refRecord1, refRecord2));
testRecordSerialization(record, RetentionSet.class);
}
use of io.pravega.controller.store.stream.records.RetentionSet in project pravega by pravega.
the class PersistentStreamBase method addStreamCutToRetentionSet.
@Override
public CompletableFuture<Void> addStreamCutToRetentionSet(StreamCutRecord record, OperationContext context) {
Preconditions.checkNotNull(context, "Operation context cannot be null");
return getRetentionSetData(context).thenCompose(data -> {
RetentionSet retention = data.getObject();
RetentionSet update = RetentionSet.addReferenceToStreamCutIfLatest(retention, record);
return createStreamCutRecordData(record.getRecordingTime(), record, context).thenCompose(v -> Futures.toVoid(updateRetentionSetData(new VersionedMetadata<>(update, data.getVersion()), context)));
});
}
Aggregations