Search in sources :

Example 6 with RetentionSet

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);
}
Also used : StreamCutReferenceRecord(io.pravega.controller.store.stream.records.StreamCutReferenceRecord) RetentionSet(io.pravega.controller.store.stream.records.RetentionSet) Test(org.junit.Test)

Example 7 with RetentionSet

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)));
    });
}
Also used : RetentionSet(io.pravega.controller.store.stream.records.RetentionSet)

Aggregations

RetentionSet (io.pravega.controller.store.stream.records.RetentionSet)7 StreamCutReferenceRecord (io.pravega.controller.store.stream.records.StreamCutReferenceRecord)6 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)5 VisibleForTesting (com.google.common.annotations.VisibleForTesting)4 Preconditions (com.google.common.base.Preconditions)4 ImmutableMap (com.google.common.collect.ImmutableMap)4 ImmutableSet (com.google.common.collect.ImmutableSet)4 Exceptions (io.pravega.common.Exceptions)4 Futures (io.pravega.common.concurrent.Futures)4 TagLogger (io.pravega.common.tracing.TagLogger)4 VersionedMetadata (io.pravega.controller.store.VersionedMetadata)4 EpochRecord (io.pravega.controller.store.stream.records.EpochRecord)4 EpochTransitionRecord (io.pravega.controller.store.stream.records.EpochTransitionRecord)4 StreamCutRecord (io.pravega.controller.store.stream.records.StreamCutRecord)4 HashMap (java.util.HashMap)4 RetentionPolicy (io.pravega.client.stream.RetentionPolicy)3 ScalingPolicy (io.pravega.client.stream.ScalingPolicy)3 StreamConfigurationRecord (io.pravega.controller.store.stream.records.StreamConfigurationRecord)3 StreamSegmentRecord (io.pravega.controller.store.stream.records.StreamSegmentRecord)3 StreamTruncationRecord (io.pravega.controller.store.stream.records.StreamTruncationRecord)3