Search in sources :

Example 6 with AsyncIterator

use of io.pravega.common.util.AsyncIterator in project pravega by pravega.

the class TableSegmentImplTest method testIterator.

private <T> void testIterator(Function<SegmentIteratorArgs, AsyncIterator<IteratorItem<T>>> newIterator, Supplier<ByteBuf> getLastRequestFromKey, Supplier<ByteBuf> getLastRequestToKey, Function<TableSegmentEntry, T> getItemFromEntry, Consumer<List<T>> sendReply, BiPredicate<T, T> checkItemEquality) throws Exception {
    val suggestedKeyCount = 3;
    // Generate 100 Entries and split them into batches.
    val allEntries = IntStream.range(0, 100).mapToObj(i -> versionedEntry(i * 10L, Integer.toString(i * 10), 1L)).collect(Collectors.toList());
    val inputEntries = splitIteratorInputs(allEntries);
    // Do an full iteration as well.
    inputEntries.add(allEntries);
    // Check regular iteration.
    for (int i = 0; i < inputEntries.size(); i++) {
        val entryList = inputEntries.get(i);
        SegmentIteratorArgs args = SegmentIteratorArgs.builder().fromKey(entryList.get(0).getKey().getKey()).toKey(entryList.get(entryList.size() - 1).getKey().getKey()).maxItemsAtOnce(suggestedKeyCount).build();
        // We collect iterated items in this list.
        val actualItems = new ArrayList<T>();
        val itemsToReturn = entryList.iterator();
        val tableIterator = newIterator.apply(args);
        while (itemsToReturn.hasNext()) {
            val iteratorFuture = tableIterator.getNext();
            // Verify the wire command got sent as expected.
            val requestFromKey = getLastRequestFromKey.get();
            Assert.assertEquals("Unexpected fromKey sent.", args.getFromKey(), requestFromKey);
            val requestToKey = getLastRequestToKey.get();
            Assert.assertEquals("Unexpected toKey sent.", args.getToKey(), requestToKey);
            // Send a reply.
            val expectedResult = new ArrayList<T>();
            int count = suggestedKeyCount;
            while (itemsToReturn.hasNext() && count > 0) {
                val next = itemsToReturn.next();
                expectedResult.add(getItemFromEntry.apply(next));
                args = args.next(next.getKey().getKey());
                count--;
            }
            sendReply.accept(expectedResult);
            // Check the partial result.
            val iteratorResult = iteratorFuture.get(SHORT_TIMEOUT, TimeUnit.MILLISECONDS);
            AssertExtensions.assertListEquals("Unexpected partial result.", expectedResult, iteratorResult.getItems(), checkItemEquality);
            actualItems.addAll(iteratorResult.getItems());
        }
        // Then the final result.
        val expected = entryList.stream().map(getItemFromEntry).collect(Collectors.toList());
        AssertExtensions.assertListEquals("Unexpected result.", expected, actualItems, checkItemEquality);
    }
}
Also used : lombok.val(lombok.val) Arrays(java.util.Arrays) NoSuchKeyException(io.pravega.client.tables.NoSuchKeyException) AssertExtensions(io.pravega.test.common.AssertExtensions) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Cleanup(lombok.Cleanup) Unpooled(io.netty.buffer.Unpooled) MockController(io.pravega.client.stream.mock.MockController) ClientConnection(io.pravega.client.connection.impl.ClientConnection) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) PravegaNodeUri(io.pravega.shared.protocol.netty.PravegaNodeUri) IteratorItem(io.pravega.client.tables.IteratorItem) Request(io.pravega.shared.protocol.netty.Request) DelegationTokenProviderFactory(io.pravega.client.security.auth.DelegationTokenProviderFactory) Collectors(java.util.stream.Collectors) RetriesExhaustedException(io.pravega.common.util.RetriesExhaustedException) List(java.util.List) ThreadPooledTestSuite(io.pravega.test.common.ThreadPooledTestSuite) TestUtils(io.pravega.test.common.TestUtils) BadKeyVersionException(io.pravega.client.tables.BadKeyVersionException) IntStream(java.util.stream.IntStream) Segment(io.pravega.client.segment.impl.Segment) Setter(lombok.Setter) Getter(lombok.Getter) ConnectionFailedException(io.pravega.shared.protocol.netty.ConnectionFailedException) Reply(io.pravega.shared.protocol.netty.Reply) Exceptions(io.pravega.common.Exceptions) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) CompletableFuture(java.util.concurrent.CompletableFuture) Deque(java.util.Deque) Append(io.pravega.shared.protocol.netty.Append) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) Supplier(java.util.function.Supplier) Iterators(com.google.common.collect.Iterators) ArrayList(java.util.ArrayList) BiPredicate(java.util.function.BiPredicate) Lists(com.google.common.collect.Lists) ByteBuf(io.netty.buffer.ByteBuf) Charsets(com.google.common.base.Charsets) LongStream(java.util.stream.LongStream) MockConnectionFactoryImpl(io.pravega.client.stream.mock.MockConnectionFactoryImpl) lombok.val(lombok.val) AsyncIterator(io.pravega.common.util.AsyncIterator) Test(org.junit.Test) AuthenticationException(io.pravega.auth.AuthenticationException) WireCommands(io.pravega.shared.protocol.netty.WireCommands) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) WireCommand(io.pravega.shared.protocol.netty.WireCommand) AbstractMap(java.util.AbstractMap) KeyValueTableClientConfiguration(io.pravega.client.tables.KeyValueTableClientConfiguration) ArrayDeque(java.util.ArrayDeque) Assert(org.junit.Assert) Collections(java.util.Collections) ArrayList(java.util.ArrayList)

Example 7 with AsyncIterator

use of io.pravega.common.util.AsyncIterator in project pravega by pravega.

the class HashTableSegmentLayout method entryDeltaIterator.

@Override
AsyncIterator<IteratorItem<TableEntry>> entryDeltaIterator(@NonNull DirectSegmentAccess segment, long fromPosition, Duration fetchTimeout) {
    val segmentInfo = segment.getInfo();
    ensureSegmentType(segmentInfo.getName(), segmentInfo.getType());
    Preconditions.checkArgument(fromPosition <= segmentInfo.getLength(), "fromPosition (%s) can not exceed the length (%s) of the TableSegment.", fromPosition, segmentInfo.getLength());
    logRequest("entryDeltaIterator", segment.getSegmentId(), fromPosition);
    long compactionOffset = segmentInfo.getAttributes().getOrDefault(TableAttributes.COMPACTION_OFFSET, 0L);
    // All of the most recent keys will exist beyond the compactionOffset.
    long startOffset = Math.max(fromPosition, compactionOffset);
    // We should clear if the starting position may have been truncated out due to compaction.
    boolean shouldClear = fromPosition < compactionOffset;
    // Maximum length of the TableSegment we want to read until.
    int maxBytesToRead = (int) (segmentInfo.getLength() - startOffset);
    TableEntryDeltaIterator.ConvertResult<IteratorItem<TableEntry>> converter = item -> CompletableFuture.completedFuture(new IteratorItemImpl<TableEntry>(item.getKey().serialize(), Collections.singletonList(item.getValue())));
    return TableEntryDeltaIterator.<IteratorItem<TableEntry>>builder().segment(segment).entrySerializer(serializer).executor(executor).maxBytesToRead(maxBytesToRead).startOffset(startOffset).currentBatchOffset(fromPosition).fetchTimeout(fetchTimeout).resultConverter(converter).shouldClear(shouldClear).build();
}
Also used : lombok.val(lombok.val) TableAttributes(io.pravega.segmentstore.contracts.tables.TableAttributes) TableSegmentConfig(io.pravega.segmentstore.contracts.tables.TableSegmentConfig) Getter(lombok.Getter) OperationPriority(io.pravega.segmentstore.server.logs.operations.OperationPriority) SneakyThrows(lombok.SneakyThrows) RequiredArgsConstructor(lombok.RequiredArgsConstructor) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) RevisionDataInput(io.pravega.common.io.serialization.RevisionDataInput) Function(java.util.function.Function) IteratorArgs(io.pravega.segmentstore.contracts.tables.IteratorArgs) UpdateableSegmentMetadata(io.pravega.segmentstore.server.UpdateableSegmentMetadata) ArrayList(java.util.ArrayList) ArrayView(io.pravega.common.util.ArrayView) SegmentMetadata(io.pravega.segmentstore.server.SegmentMetadata) SegmentType(io.pravega.segmentstore.contracts.SegmentType) IteratorItem(io.pravega.segmentstore.contracts.tables.IteratorItem) Runnables(com.google.common.util.concurrent.Runnables) BufferView(io.pravega.common.util.BufferView) Duration(java.time.Duration) Map(java.util.Map) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) RevisionDataOutput(io.pravega.common.io.serialization.RevisionDataOutput) VersionedSerializer(io.pravega.common.io.serialization.VersionedSerializer) IteratorState(io.pravega.segmentstore.contracts.tables.IteratorState) Attributes(io.pravega.segmentstore.contracts.Attributes) TableKey(io.pravega.segmentstore.contracts.tables.TableKey) TimeoutTimer(io.pravega.common.TimeoutTimer) NonNull(lombok.NonNull) Collection(java.util.Collection) AttributeId(io.pravega.segmentstore.contracts.AttributeId) lombok.val(lombok.val) AsyncIterator(io.pravega.common.util.AsyncIterator) IOException(java.io.IOException) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) ObjectBuilder(io.pravega.common.ObjectBuilder) DirectSegmentAccess(io.pravega.segmentstore.server.DirectSegmentAccess) List(java.util.List) TableSegmentInfo(io.pravega.segmentstore.contracts.tables.TableSegmentInfo) Preconditions(com.google.common.base.Preconditions) IllegalDataFormatException(io.pravega.common.util.IllegalDataFormatException) WriterSegmentProcessor(io.pravega.segmentstore.server.WriterSegmentProcessor) TableEntry(io.pravega.segmentstore.contracts.tables.TableEntry) Collections(java.util.Collections) Futures(io.pravega.common.concurrent.Futures) CacheManager(io.pravega.segmentstore.server.CacheManager) TableEntry(io.pravega.segmentstore.contracts.tables.TableEntry) IteratorItem(io.pravega.segmentstore.contracts.tables.IteratorItem)

Example 8 with AsyncIterator

use of io.pravega.common.util.AsyncIterator in project pravega by pravega.

the class ScopeTest method testListStreams.

@Test(timeout = 30000)
public void testListStreams() throws Exception {
    final String scope = "test";
    final String streamName1 = "test1";
    final String streamName2 = "test2";
    final String streamName3 = "test3";
    final Map<String, Integer> foundCount = new HashMap<>();
    foundCount.put(streamName1, 0);
    foundCount.put(streamName2, 0);
    foundCount.put(streamName3, 0);
    foundCount.put(NameUtils.getMarkStreamForStream(streamName1), 0);
    foundCount.put(NameUtils.getMarkStreamForStream(streamName2), 0);
    foundCount.put(NameUtils.getMarkStreamForStream(streamName3), 0);
    StreamConfiguration config = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.byEventRate(10, 2, 1)).build();
    @Cleanup Controller controller = controllerWrapper.getController();
    ClientConfig clientConfig = ClientConfig.builder().controllerURI(URI.create("tcp://localhost")).build();
    @Cleanup ConnectionPool cp = new ConnectionPoolImpl(clientConfig, new SocketConnectionFactoryImpl(clientConfig));
    controllerWrapper.getControllerService().createScope(scope, 0L).get();
    controller.createStream(scope, streamName1, config).get();
    controller.createStream(scope, streamName2, config).get();
    controller.createStream(scope, streamName3, config).get();
    @Cleanup StreamManager manager = new StreamManagerImpl(controller, cp);
    Iterator<Stream> iterator = manager.listStreams(scope);
    assertTrue(iterator.hasNext());
    Stream next = iterator.next();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    assertTrue(iterator.hasNext());
    next = iterator.next();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    assertTrue(iterator.hasNext());
    next = iterator.next();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    assertTrue(iterator.hasNext());
    next = iterator.next();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    assertTrue(iterator.hasNext());
    next = iterator.next();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    assertTrue(iterator.hasNext());
    next = iterator.next();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    assertFalse(iterator.hasNext());
    assertTrue(foundCount.entrySet().stream().allMatch(x -> x.getValue() == 1));
    AsyncIterator<Stream> asyncIterator = controller.listStreams(scope);
    next = asyncIterator.getNext().join();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    next = asyncIterator.getNext().join();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    next = asyncIterator.getNext().join();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    next = asyncIterator.getNext().join();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    next = asyncIterator.getNext().join();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    next = asyncIterator.getNext().join();
    foundCount.computeIfPresent(next.getStreamName(), (x, y) -> ++y);
    next = asyncIterator.getNext().join();
    assertNull(next);
    assertTrue(foundCount.entrySet().stream().allMatch(x -> x.getValue() == 2));
}
Also used : ConnectionPool(io.pravega.client.connection.impl.ConnectionPool) Arrays(java.util.Arrays) TableStore(io.pravega.segmentstore.contracts.tables.TableStore) AssertExtensions(io.pravega.test.common.AssertExtensions) ReaderGroupManagerImpl(io.pravega.client.admin.impl.ReaderGroupManagerImpl) Cleanup(lombok.Cleanup) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) KeyValueTableConfiguration(io.pravega.client.tables.KeyValueTableConfiguration) ServiceBuilderConfig(io.pravega.segmentstore.server.store.ServiceBuilderConfig) Collections.singletonList(java.util.Collections.singletonList) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) ReaderGroupManager(io.pravega.client.admin.ReaderGroupManager) Stream(io.pravega.client.stream.Stream) After(org.junit.After) Map(java.util.Map) Status(io.grpc.Status) URI(java.net.URI) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) Collections.emptyList(java.util.Collections.emptyList) Set(java.util.Set) List(java.util.List) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) StreamManagerImpl(io.pravega.client.admin.impl.StreamManagerImpl) KeyValueTableManagerImpl(io.pravega.client.admin.impl.KeyValueTableManagerImpl) Assert.assertFalse(org.junit.Assert.assertFalse) TestUtils(io.pravega.test.common.TestUtils) ControllerWrapper(io.pravega.test.integration.demo.ControllerWrapper) Controller(io.pravega.client.control.impl.Controller) ConnectionFactory(io.pravega.client.connection.impl.ConnectionFactory) StreamManager(io.pravega.client.admin.StreamManager) HashMap(java.util.HashMap) ConnectionPoolImpl(io.pravega.client.connection.impl.ConnectionPoolImpl) KeyValueTableManager(io.pravega.client.admin.KeyValueTableManager) TestingServerStarter(io.pravega.test.common.TestingServerStarter) TestingServer(org.apache.curator.test.TestingServer) SocketConnectionFactoryImpl(io.pravega.client.connection.impl.SocketConnectionFactoryImpl) Before(org.junit.Before) NameUtils(io.pravega.shared.NameUtils) Iterator(java.util.Iterator) ConnectionPool(io.pravega.client.connection.impl.ConnectionPool) Assert.assertTrue(org.junit.Assert.assertTrue) AsyncIterator(io.pravega.common.util.AsyncIterator) Test(org.junit.Test) StatusRuntimeException(io.grpc.StatusRuntimeException) Assert.assertNull(org.junit.Assert.assertNull) NameUtils.getScopedStreamName(io.pravega.shared.NameUtils.getScopedStreamName) ScalingPolicy(io.pravega.client.stream.ScalingPolicy) Assert.assertEquals(org.junit.Assert.assertEquals) ClientConfig(io.pravega.client.ClientConfig) HashMap(java.util.HashMap) ConnectionPoolImpl(io.pravega.client.connection.impl.ConnectionPoolImpl) StreamManagerImpl(io.pravega.client.admin.impl.StreamManagerImpl) Controller(io.pravega.client.control.impl.Controller) SocketConnectionFactoryImpl(io.pravega.client.connection.impl.SocketConnectionFactoryImpl) Cleanup(lombok.Cleanup) StreamManager(io.pravega.client.admin.StreamManager) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) Stream(io.pravega.client.stream.Stream) ClientConfig(io.pravega.client.ClientConfig) Test(org.junit.Test)

Example 9 with AsyncIterator

use of io.pravega.common.util.AsyncIterator in project pravega by pravega.

the class ControllerImpl method listKeyValueTables.

@Override
public AsyncIterator<KeyValueTableInfo> listKeyValueTables(String scopeName) {
    Exceptions.checkNotClosed(closed.get(), this);
    long traceId = LoggerHelpers.traceEnter(log, "listKeyValueTables", scopeName);
    long requestId = requestIdGenerator.get();
    try {
        final Function<ContinuationToken, CompletableFuture<Map.Entry<ContinuationToken, Collection<KeyValueTableInfo>>>> function = token -> this.retryConfig.runAsync(() -> {
            RPCAsyncCallback<KVTablesInScopeResponse> callback = new RPCAsyncCallback<>(requestId, "listKeyValueTables", scopeName);
            ScopeInfo scopeInfo = ScopeInfo.newBuilder().setScope(scopeName).build();
            new ControllerClientTagger(client, timeoutMillis).withTag(requestId, LIST_KEY_VALUE_TABLES, scopeName).listKeyValueTables(KVTablesInScopeRequest.newBuilder().setScope(scopeInfo).setContinuationToken(token).build(), callback);
            return callback.getFuture().thenApplyAsync(x -> {
                switch(x.getStatus()) {
                    case SCOPE_NOT_FOUND:
                        log.warn(requestId, "Scope not found: {}", scopeName);
                        throw new NoSuchScopeException();
                    case FAILURE:
                        log.warn(requestId, "Internal Server Error while trying to list streams in scope: {}", scopeName);
                        throw new RuntimeException("Failure while trying to list streams");
                    case SUCCESS:
                    // compatibility reasons
                    default:
                        List<KeyValueTableInfo> kvtList = x.getKvtablesList().stream().map(y -> new KeyValueTableInfo(y.getScope(), y.getKvtName())).collect(Collectors.toList());
                        return new AbstractMap.SimpleEntry<>(x.getContinuationToken(), kvtList);
                }
            }, this.executor);
        }, this.executor);
        return new ContinuationTokenAsyncIterator<>(function, ContinuationToken.newBuilder().build());
    } finally {
        LoggerHelpers.traceLeave(log, "listKeyValueTables", traceId);
    }
}
Also used : StreamCut(io.pravega.client.stream.StreamCut) StreamConfig(io.pravega.controller.stream.api.grpc.v1.Controller.StreamConfig) NegotiationType(io.grpc.netty.shaded.io.grpc.netty.NegotiationType) MoreCallCredentials(io.grpc.auth.MoreCallCredentials) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) PingTxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest) DELETE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_STREAM) SegmentRanges(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRanges) StreamSegments(io.pravega.client.stream.impl.StreamSegments) NoSuchScopeException(io.pravega.client.stream.NoSuchScopeException) TRUNCATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.TRUNCATE_STREAM) AccessOperation(io.pravega.shared.security.auth.AccessOperation) Map(java.util.Map) SubscriberStreamCut(io.pravega.controller.stream.api.grpc.v1.Controller.SubscriberStreamCut) LIST_SCOPES(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_SCOPES) UPDATE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_READER_GROUP) UPDATE_TRUNCATION_STREAM_CUT(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_TRUNCATION_STREAM_CUT) ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) DeleteScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteScopeStatus) GET_SEGMENTS_IMMEDIATELY_FOLLOWING(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_IMMEDIATELY_FOLLOWING) ReaderGroupInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupInfo) REMOVE_WRITER(io.pravega.shared.controller.tracing.RPCTracingTags.REMOVE_WRITER) GET_SEGMENTS_BETWEEN_STREAM_CUTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_BETWEEN_STREAM_CUTS) LIST_STREAMS_IN_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_STREAMS_IN_SCOPE) SslContextBuilder(io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder) RequestTracker(io.pravega.common.tracing.RequestTracker) ScopesResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScopesResponse) SSLException(javax.net.ssl.SSLException) KVTablesInScopeRequest(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeRequest) GET_STREAM_CONFIGURATION(io.pravega.shared.controller.tracing.RPCTracingTags.GET_STREAM_CONFIGURATION) Futures(io.pravega.common.concurrent.Futures) KeyValueTableSegments(io.pravega.client.tables.impl.KeyValueTableSegments) SegmentId(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentId) StreamCutRangeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.StreamCutRangeResponse) CreateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateReaderGroupResponse) LIST_KEY_VALUE_TABLES(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_KEY_VALUE_TABLES) KeyValueTableConfig(io.pravega.controller.stream.api.grpc.v1.Controller.KeyValueTableConfig) GrpcSslContexts(io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts) Exceptions(io.pravega.common.Exceptions) ScopeInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ScopeInfo) StreamsInScopeWithTagRequest(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeWithTagRequest) ModelHelper.encode(io.pravega.client.control.impl.ModelHelper.encode) GET_KEY_VALUE_TABLE_CONFIGURATION(io.pravega.shared.controller.tracing.RPCTracingTags.GET_KEY_VALUE_TABLE_CONFIGURATION) Supplier(java.util.function.Supplier) UpdateSubscriberStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateSubscriberStatus) PingFailedException(io.pravega.client.stream.PingFailedException) Strings(com.google.common.base.Strings) Code(io.grpc.Status.Code) NodeUri(io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri) ReaderGroupConfiguration(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfiguration) StreamInfo(io.pravega.controller.stream.api.grpc.v1.Controller.StreamInfo) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) GET_SUCCESSORS_FROM_CUT(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SUCCESSORS_FROM_CUT) ControllerServiceGrpc(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc) START_SCALE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.START_SCALE_STREAM) StreamSegmentsWithPredecessors(io.pravega.client.stream.impl.StreamSegmentsWithPredecessors) ExistsResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ExistsResponse) RemoveWriterResponse(io.pravega.controller.stream.api.grpc.v1.Controller.RemoveWriterResponse) Callbacks(io.pravega.common.function.Callbacks) AsyncIterator(io.pravega.common.util.AsyncIterator) SegmentRange(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRange) WriterPosition(io.pravega.client.stream.impl.WriterPosition) File(java.io.File) StatusRuntimeException(io.grpc.StatusRuntimeException) CREATE_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_TRANSACTION) RPCTracingHelpers(io.pravega.shared.controller.tracing.RPCTracingHelpers) LIST_STREAMS_IN_SCOPE_FOR_TAG(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_STREAMS_IN_SCOPE_FOR_TAG) TreeMap(java.util.TreeMap) TxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.TxnStatus) Preconditions(com.google.common.base.Preconditions) DeleteReaderGroupStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteReaderGroupStatus) SegmentsAtTime(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentsAtTime) TxnFailedException(io.pravega.client.stream.TxnFailedException) CreateKeyValueTableStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateKeyValueTableStatus) GET_CURRENT_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_CURRENT_SEGMENTS) CHECK_TRANSACTION_STATE(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_TRANSACTION_STATE) CREATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_STREAM) ManagedChannel(io.grpc.ManagedChannel) Retry(io.pravega.common.util.Retry) LoggerFactory(org.slf4j.LoggerFactory) KeyValueTableConfiguration(io.pravega.client.tables.KeyValueTableConfiguration) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) StreamsInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeResponse) ContinuationToken(io.pravega.controller.stream.api.grpc.v1.Controller.ContinuationToken) GetSegmentsRequest(io.pravega.controller.stream.api.grpc.v1.Controller.GetSegmentsRequest) StreamObserver(io.grpc.stub.StreamObserver) TagLogger(io.pravega.common.tracing.TagLogger) ControllerServiceStub(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceStub) CREATE_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_KEY_VALUE_TABLE) KeyValueTableInfo(io.pravega.client.admin.KeyValueTableInfo) Stream(io.pravega.client.stream.Stream) KVTablesInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeResponse) PravegaNodeUri(io.pravega.shared.protocol.netty.PravegaNodeUri) SubscribersResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SubscribersResponse) Transaction(io.pravega.client.stream.Transaction) DELETE_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_KEY_VALUE_TABLE) TxnSegments(io.pravega.client.stream.impl.TxnSegments) RetryAndThrowConditionally(io.pravega.common.util.Retry.RetryAndThrowConditionally) CreateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus) CHECK_SCOPE_EXISTS(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_SCOPE_EXISTS) LIST_SUBSCRIBERS(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_SUBSCRIBERS) CHECK_STREAM_EXISTS(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_STREAM_EXISTS) CREATE_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_SCOPE) Collection(java.util.Collection) DelegationToken(io.pravega.controller.stream.api.grpc.v1.Controller.DelegationToken) CompletionException(java.util.concurrent.CompletionException) UUID(java.util.UUID) COMMIT_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.COMMIT_TRANSACTION) NavigableMap(java.util.NavigableMap) Collectors(java.util.stream.Collectors) GET_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS) GET_EPOCH_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_EPOCH_SEGMENTS) SEAL_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.SEAL_STREAM) SegmentWithRange(io.pravega.client.stream.impl.SegmentWithRange) List(java.util.List) ABORT_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.ABORT_TRANSACTION) CreateTxnResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnResponse) GET_URI(io.pravega.shared.controller.tracing.RPCTracingTags.GET_URI) GetEpochSegmentsRequest(io.pravega.controller.stream.api.grpc.v1.Controller.GetEpochSegmentsRequest) DELETE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_READER_GROUP) TimestampFromWriter(io.pravega.controller.stream.api.grpc.v1.Controller.TimestampFromWriter) DELETE_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_SCOPE) PING_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.PING_TRANSACTION) PingTxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus) DELETE_SCOPE_RECURSIVE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_SCOPE_RECURSIVE) Segment(io.pravega.client.segment.impl.Segment) CreateScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus) StreamImpl(io.pravega.client.stream.impl.StreamImpl) ScaleStatusRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusRequest) KeyValueTableConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KeyValueTableConfigResponse) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) IS_SEGMENT_OPEN(io.pravega.shared.controller.tracing.RPCTracingTags.IS_SEGMENT_OPEN) ScaleStatusResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusResponse) TxnState(io.pravega.controller.stream.api.grpc.v1.Controller.TxnState) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) Function(java.util.function.Function) SuccessorResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SuccessorResponse) GET_OR_REFRESH_DELEGATION_TOKEN_FOR(io.pravega.shared.controller.tracing.RPCTracingTags.GET_OR_REFRESH_DELEGATION_TOKEN_FOR) ScaleRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest) DeleteKVTableStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteKVTableStatus) CreateTxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnRequest) GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE) ScopesRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScopesRequest) DeleteStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteStreamStatus) NOTE_TIMESTAMP_FROM_WRITER(io.pravega.shared.controller.tracing.RPCTracingTags.NOTE_TIMESTAMP_FROM_WRITER) CHECK_SCALE(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_SCALE) NettyChannelBuilder(io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder) UPDATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_STREAM) CREATE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_READER_GROUP) ScaleResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse) SCALE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.SCALE_STREAM) LoggerHelpers(io.pravega.common.LoggerHelpers) UpdateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateReaderGroupResponse) NameUtils(io.pravega.shared.NameUtils) TimestampResponse(io.pravega.controller.stream.api.grpc.v1.Controller.TimestampResponse) StreamsInScopeRequest(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeRequest) RemoveWriterRequest(io.pravega.controller.stream.api.grpc.v1.Controller.RemoveWriterRequest) GET_READER_GROUP_CONFIG(io.pravega.shared.controller.tracing.RPCTracingTags.GET_READER_GROUP_CONFIG) StreamSegmentSuccessors(io.pravega.client.stream.impl.StreamSegmentSuccessors) TimeUnit(java.util.concurrent.TimeUnit) ManagedChannelBuilder(io.grpc.ManagedChannelBuilder) AbstractMap(java.util.AbstractMap) UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) ContinuationTokenAsyncIterator(io.pravega.common.util.ContinuationTokenAsyncIterator) InvalidStreamException(io.pravega.client.stream.InvalidStreamException) Credentials(io.pravega.shared.security.auth.Credentials) VisibleForTesting(com.google.common.annotations.VisibleForTesting) RandomFactory(io.pravega.common.hash.RandomFactory) TxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.TxnRequest) ReaderGroupConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfigResponse) SegmentValidityResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentValidityResponse) Collections(java.util.Collections) ContinuationToken(io.pravega.controller.stream.api.grpc.v1.Controller.ContinuationToken) ScopeInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ScopeInfo) NoSuchScopeException(io.pravega.client.stream.NoSuchScopeException) KeyValueTableInfo(io.pravega.client.admin.KeyValueTableInfo) KVTablesInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeResponse) CompletableFuture(java.util.concurrent.CompletableFuture) StatusRuntimeException(io.grpc.StatusRuntimeException) ContinuationTokenAsyncIterator(io.pravega.common.util.ContinuationTokenAsyncIterator) Collection(java.util.Collection) Map(java.util.Map) TreeMap(java.util.TreeMap) NavigableMap(java.util.NavigableMap) HashMap(java.util.HashMap) AbstractMap(java.util.AbstractMap)

Aggregations

AsyncIterator (io.pravega.common.util.AsyncIterator)9 Collections (java.util.Collections)8 List (java.util.List)8 Map (java.util.Map)8 HashMap (java.util.HashMap)7 CompletableFuture (java.util.concurrent.CompletableFuture)7 Function (java.util.function.Function)7 Collectors (java.util.stream.Collectors)7 Futures (io.pravega.common.concurrent.Futures)6 Preconditions (com.google.common.base.Preconditions)5 ReaderGroupConfig (io.pravega.client.stream.ReaderGroupConfig)5 Stream (io.pravega.client.stream.Stream)5 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)5 StatusRuntimeException (io.grpc.StatusRuntimeException)4 KeyValueTableInfo (io.pravega.client.admin.KeyValueTableInfo)4 Segment (io.pravega.client.segment.impl.Segment)4 InvalidStreamException (io.pravega.client.stream.InvalidStreamException)4 ReaderGroupNotFoundException (io.pravega.client.stream.ReaderGroupNotFoundException)4 Collection (java.util.Collection)4 KeyValueTableConfiguration (io.pravega.client.tables.KeyValueTableConfiguration)3