TanYuxin-tyx commented on code in PR #22330: URL: https://github.com/apache/flink/pull/22330#discussion_r1180104030
########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/common/TieredStorageConfiguration.java: ########## @@ -0,0 +1,69 @@ +/* + * 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.common; + +/** Configurations for the Tiered Storage. */ +public class TieredStorageConfiguration { + + private enum TierType { + IN_MEM, + IN_DISK, + IN_REMOTE, + } + + private static final TierType[] DEFAULT_MEMORY_DISK_TIER_TYPES = + new TierType[] {TierType.IN_MEM, TierType.IN_DISK}; + + private final TierType[] tierTypes; + + private TieredStorageConfiguration(TierType[] tierTypes) { + this.tierTypes = tierTypes; + } + + public int[] getTierIndexes() { + int[] tierIndexes = new int[tierTypes.length]; + for (int i = 0; i < tierTypes.length; i++) { + tierIndexes[i] = i; + } + return tierIndexes; + } + + public static TierType[] memoryDiskTierTypes() { Review Comment: Removed it. In the first version, only the default tier type is supported, so I removed `memoryDiskTierTypes `. Currently, the default value is a fixed value. So I changed `TieredStorageConfiguration#getDefaultTierTypes` into a private method, and get the tierTypes when building the configuration. There is a TODO here, the `getDefaultTierTypes` should add a new argument in the future. And this method will be like this after adding the option of remote storage path. ``` private static TierType[] getDefaultTierTypes(String remoteStorageHomePath) { return remoteStorageHomePath == null ? DEFAULT_MEMORY_DISK_TIER_TYPES : DEFAULT_MEMORY_DISK_REMOTE_TIER_TYPES; } ``` -- 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]
