TanYuxin-tyx commented on code in PR #22342: URL: https://github.com/apache/flink/pull/22342#discussion_r1209299273
########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/EndOfSegmentEvent.java: ########## @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.api; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.core.memory.DataInputView; +import org.apache.flink.core.memory.DataOutputView; +import org.apache.flink.runtime.event.RuntimeEvent; + +import java.io.IOException; + +/** + * {@link EndOfSegmentEvent} is used to notify the downstream switch tiers in Tiered Store shuffle Review Comment: All the `Tiered Store` should be renamed to `tiered storage`(Little case). ########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/netty/ConsumerNettyService.java: ########## @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered.netty; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.partition.consumer.InputChannel; + +import java.util.Optional; +import java.util.function.BiConsumer; + +/** {@link ConsumerNettyService} is used to consume buffer from netty client in consumer side. */ +public interface ConsumerNettyService { + + /** + * Set up the netty service in consumer side. + * + * @param inputChannels in consumer side. + * @param lastPrioritySequenceNumber is the array to record the priority sequence number. + * @param subpartitionAvailableNotifier is used to notify the subpartition is available. + */ + void setup( + InputChannel[] inputChannels, + int[] lastPrioritySequenceNumber, + BiConsumer<Integer, Boolean> subpartitionAvailableNotifier); + + /** + * Read a buffer related to the specific subpartition from NettyService. Review Comment: Where is the NettyService? We had better use {@link xxx} instead, otherwise, when renaming a class, the code similar to this maybe wrongly ignored. ########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/netty/CreditBasedBufferQueueViewImpl.java: ########## @@ -0,0 +1,113 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered.netty; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.buffer.Buffer.DataType; +import org.apache.flink.runtime.io.network.partition.BufferAvailabilityListener; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.storage.BufferContext; + +import javax.annotation.concurrent.GuardedBy; + +import java.io.IOException; +import java.util.Optional; +import java.util.Queue; + +import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.util.Preconditions.checkState; + +/** The implementation of {@link CreditBasedBufferQueueView}. */ +public class CreditBasedBufferQueueViewImpl implements CreditBasedBufferQueueView { + + private final BufferAvailabilityListener availabilityListener; + + private int consumedBufferIndex = -1; + + @GuardedBy("viewLock") Review Comment: This should be removed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
