use of io.pravega.segmentstore.contracts.Attributes.ATTRIBUTE_SEGMENT_TYPE in project pravega by pravega.
the class AppendProcessor method createTransientSegment.
@Override
public void createTransientSegment(CreateTransientSegment createTransientSegment) {
String operation = "createTransientSegment";
long traceId = LoggerHelpers.traceEnter(log, operation, createTransientSegment);
Collection<AttributeUpdate> attributes = Arrays.asList(new AttributeUpdate(CREATION_TIME, AttributeUpdateType.None, System.currentTimeMillis()), new AttributeUpdate(ATTRIBUTE_SEGMENT_TYPE, AttributeUpdateType.None, SegmentType.TRANSIENT_SEGMENT.getValue()));
String transientSegmentName = NameUtils.getTransientNameFromId(createTransientSegment.getParentSegment(), createTransientSegment.getWriterId());
store.createStreamSegment(transientSegmentName, SegmentType.TRANSIENT_SEGMENT, attributes, TIMEOUT).thenAccept(v -> {
transientSegmentNames.add(transientSegmentName);
connection.send(new SegmentCreated(createTransientSegment.getRequestId(), transientSegmentName));
}).exceptionally(e -> handleException(createTransientSegment.getWriterId(), createTransientSegment.getRequestId(), transientSegmentName, operation, e));
LoggerHelpers.traceLeave(log, operation, traceId);
}
Aggregations