Search in sources :

Example 1 with TableSegmentConfig

use of io.pravega.segmentstore.contracts.tables.TableSegmentConfig in project pravega by pravega.

the class ContainerTableExtensionImpl method createSegment.

// endregion
// region TableStore Implementation
@Override
public CompletableFuture<Void> createSegment(@NonNull String segmentName, SegmentType segmentType, TableSegmentConfig config, Duration timeout) {
    Exceptions.checkNotClosed(this.closed.get(), this);
    // Ensure at least a TableSegment type.
    segmentType = SegmentType.builder(segmentType).tableSegment().build();
    val attributes = new HashMap<>(TableAttributes.DEFAULT_VALUES);
    attributes.putAll(selectLayout(segmentName, segmentType).getNewSegmentAttributes(config));
    val attributeUpdates = attributes.entrySet().stream().map(e -> new AttributeUpdate(e.getKey(), AttributeUpdateType.None, e.getValue())).collect(Collectors.toList());
    logRequest("createSegment", segmentName, segmentType, config);
    return this.segmentContainer.createStreamSegment(segmentName, segmentType, attributeUpdates, timeout);
}
Also used : lombok.val(lombok.val) TableAttributes(io.pravega.segmentstore.contracts.tables.TableAttributes) TableSegmentConfig(io.pravega.segmentstore.contracts.tables.TableSegmentConfig) Getter(lombok.Getter) Exceptions(io.pravega.common.Exceptions) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) IteratorArgs(io.pravega.segmentstore.contracts.tables.IteratorArgs) UpdateableSegmentMetadata(io.pravega.segmentstore.server.UpdateableSegmentMetadata) AttributeUpdate(io.pravega.segmentstore.contracts.AttributeUpdate) SegmentMetadata(io.pravega.segmentstore.server.SegmentMetadata) SegmentType(io.pravega.segmentstore.contracts.SegmentType) IteratorItem(io.pravega.segmentstore.contracts.tables.IteratorItem) BufferView(io.pravega.common.util.BufferView) Duration(java.time.Duration) BadSegmentTypeException(io.pravega.segmentstore.contracts.BadSegmentTypeException) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) TableKey(io.pravega.segmentstore.contracts.tables.TableKey) TimeoutTimer(io.pravega.common.TimeoutTimer) NonNull(lombok.NonNull) Collection(java.util.Collection) lombok.val(lombok.val) AsyncIterator(io.pravega.common.util.AsyncIterator) Collectors(java.util.stream.Collectors) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) TableSegmentInfo(io.pravega.segmentstore.contracts.tables.TableSegmentInfo) SegmentContainer(io.pravega.segmentstore.server.SegmentContainer) VisibleForTesting(com.google.common.annotations.VisibleForTesting) AttributeUpdateType(io.pravega.segmentstore.contracts.AttributeUpdateType) WriterSegmentProcessor(io.pravega.segmentstore.server.WriterSegmentProcessor) TableEntry(io.pravega.segmentstore.contracts.tables.TableEntry) Collections(java.util.Collections) CacheManager(io.pravega.segmentstore.server.CacheManager) AttributeUpdate(io.pravega.segmentstore.contracts.AttributeUpdate) HashMap(java.util.HashMap)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Exceptions (io.pravega.common.Exceptions)1 TimeoutTimer (io.pravega.common.TimeoutTimer)1 AsyncIterator (io.pravega.common.util.AsyncIterator)1 BufferView (io.pravega.common.util.BufferView)1 AttributeUpdate (io.pravega.segmentstore.contracts.AttributeUpdate)1 AttributeUpdateType (io.pravega.segmentstore.contracts.AttributeUpdateType)1 BadSegmentTypeException (io.pravega.segmentstore.contracts.BadSegmentTypeException)1 SegmentType (io.pravega.segmentstore.contracts.SegmentType)1 IteratorArgs (io.pravega.segmentstore.contracts.tables.IteratorArgs)1 IteratorItem (io.pravega.segmentstore.contracts.tables.IteratorItem)1 TableAttributes (io.pravega.segmentstore.contracts.tables.TableAttributes)1 TableEntry (io.pravega.segmentstore.contracts.tables.TableEntry)1 TableKey (io.pravega.segmentstore.contracts.tables.TableKey)1 TableSegmentConfig (io.pravega.segmentstore.contracts.tables.TableSegmentConfig)1 TableSegmentInfo (io.pravega.segmentstore.contracts.tables.TableSegmentInfo)1 CacheManager (io.pravega.segmentstore.server.CacheManager)1 SegmentContainer (io.pravega.segmentstore.server.SegmentContainer)1 SegmentMetadata (io.pravega.segmentstore.server.SegmentMetadata)1 UpdateableSegmentMetadata (io.pravega.segmentstore.server.UpdateableSegmentMetadata)1