Search in sources :

Example 1 with ATTRIBUTE_SEGMENT_TYPE

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);
}
Also used : Arrays(java.util.Arrays) StreamSegmentNotExistsException(io.pravega.segmentstore.contracts.StreamSegmentNotExistsException) TokenExpiredException(io.pravega.auth.TokenExpiredException) AuthHandler(io.pravega.auth.AuthHandler) LoggerFactory(org.slf4j.LoggerFactory) CREATION_TIME(io.pravega.segmentstore.contracts.Attributes.CREATION_TIME) AttributeUpdate(io.pravega.segmentstore.contracts.AttributeUpdate) StreamSegmentSealedException(io.pravega.segmentstore.contracts.StreamSegmentSealedException) TagLogger(io.pravega.common.tracing.TagLogger) Pair(org.apache.commons.lang3.tuple.Pair) Duration(java.time.Duration) SegmentStatsRecorder(io.pravega.segmentstore.server.host.stat.SegmentStatsRecorder) SegmentCreated(io.pravega.shared.protocol.netty.WireCommands.SegmentCreated) StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) Attributes(io.pravega.segmentstore.contracts.Attributes) CancellationException(java.util.concurrent.CancellationException) NonNull(lombok.NonNull) AppendSetup(io.pravega.shared.protocol.netty.WireCommands.AppendSetup) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ContainerNotFoundException(io.pravega.segmentstore.contracts.ContainerNotFoundException) UUID(java.util.UUID) StreamSegmentExistsException(io.pravega.segmentstore.contracts.StreamSegmentExistsException) Builder(lombok.Builder) BadOffsetException(io.pravega.segmentstore.contracts.BadOffsetException) DelegationTokenVerifier(io.pravega.segmentstore.server.host.delegationtoken.DelegationTokenVerifier) ATTRIBUTE_SEGMENT_TYPE(io.pravega.segmentstore.contracts.Attributes.ATTRIBUTE_SEGMENT_TYPE) DataAppended(io.pravega.shared.protocol.netty.WireCommands.DataAppended) SegmentIsSealed(io.pravega.shared.protocol.netty.WireCommands.SegmentIsSealed) Futures(io.pravega.common.concurrent.Futures) Getter(lombok.Getter) IllegalContainerStateException(io.pravega.segmentstore.server.IllegalContainerStateException) NoSuchSegment(io.pravega.shared.protocol.netty.WireCommands.NoSuchSegment) Exceptions(io.pravega.common.Exceptions) ConditionalCheckFailed(io.pravega.shared.protocol.netty.WireCommands.ConditionalCheckFailed) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) CompletableFuture(java.util.concurrent.CompletableFuture) BadAttributeUpdateException(io.pravega.segmentstore.contracts.BadAttributeUpdateException) Append(io.pravega.shared.protocol.netty.Append) DelegatingRequestProcessor(io.pravega.shared.protocol.netty.DelegatingRequestProcessor) CreateTransientSegment(io.pravega.shared.protocol.netty.WireCommands.CreateTransientSegment) JsonWebToken(io.pravega.shared.security.token.JsonWebToken) HashSet(java.util.HashSet) SetupAppend(io.pravega.shared.protocol.netty.WireCommands.SetupAppend) SegmentType(io.pravega.segmentstore.contracts.SegmentType) FailingRequestProcessor(io.pravega.shared.protocol.netty.FailingRequestProcessor) TokenException(io.pravega.auth.TokenException) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) Hello(io.pravega.shared.protocol.netty.WireCommands.Hello) SegmentAlreadyExists(io.pravega.shared.protocol.netty.WireCommands.SegmentAlreadyExists) ByteBufWrapper(io.pravega.shared.protocol.netty.ByteBufWrapper) LoggerHelpers(io.pravega.common.LoggerHelpers) NameUtils(io.pravega.shared.NameUtils) EVENT_COUNT(io.pravega.segmentstore.contracts.Attributes.EVENT_COUNT) AttributeId(io.pravega.segmentstore.contracts.AttributeId) Throwables(com.google.common.base.Throwables) WireCommands(io.pravega.shared.protocol.netty.WireCommands) Timer(io.pravega.common.Timer) WrongHost(io.pravega.shared.protocol.netty.WireCommands.WrongHost) InvalidEventNumber(io.pravega.shared.protocol.netty.WireCommands.InvalidEventNumber) AttributeUpdateCollection(io.pravega.segmentstore.contracts.AttributeUpdateCollection) RequestProcessor(io.pravega.shared.protocol.netty.RequestProcessor) OperationUnsupported(io.pravega.shared.protocol.netty.WireCommands.OperationUnsupported) Preconditions(com.google.common.base.Preconditions) VisibleForTesting(com.google.common.annotations.VisibleForTesting) AttributeUpdateType(io.pravega.segmentstore.contracts.AttributeUpdateType) Collections(java.util.Collections) AttributeUpdate(io.pravega.segmentstore.contracts.AttributeUpdate) SegmentCreated(io.pravega.shared.protocol.netty.WireCommands.SegmentCreated)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions (com.google.common.base.Preconditions)1 Throwables (com.google.common.base.Throwables)1 AuthHandler (io.pravega.auth.AuthHandler)1 TokenException (io.pravega.auth.TokenException)1 TokenExpiredException (io.pravega.auth.TokenExpiredException)1 Exceptions (io.pravega.common.Exceptions)1 LoggerHelpers (io.pravega.common.LoggerHelpers)1 Timer (io.pravega.common.Timer)1 Futures (io.pravega.common.concurrent.Futures)1 TagLogger (io.pravega.common.tracing.TagLogger)1 AttributeId (io.pravega.segmentstore.contracts.AttributeId)1 AttributeUpdate (io.pravega.segmentstore.contracts.AttributeUpdate)1 AttributeUpdateCollection (io.pravega.segmentstore.contracts.AttributeUpdateCollection)1 AttributeUpdateType (io.pravega.segmentstore.contracts.AttributeUpdateType)1 Attributes (io.pravega.segmentstore.contracts.Attributes)1 ATTRIBUTE_SEGMENT_TYPE (io.pravega.segmentstore.contracts.Attributes.ATTRIBUTE_SEGMENT_TYPE)1 CREATION_TIME (io.pravega.segmentstore.contracts.Attributes.CREATION_TIME)1 EVENT_COUNT (io.pravega.segmentstore.contracts.Attributes.EVENT_COUNT)1 BadAttributeUpdateException (io.pravega.segmentstore.contracts.BadAttributeUpdateException)1