zhangyue19921010 commented on code in PR #12407:
URL: https://github.com/apache/hudi/pull/12407#discussion_r1870571856
##########
rfc/rfc-60/rfc-60.md:
##########
@@ -84,23 +119,85 @@ public interface HoodieStorageStrategy extends
Serializable {
/**
* Return a storage location for the given filename.
*
- * @param fileId data file ID
+ * @param path fileName
* @return a storage location string for a data file
*/
- String storageLocation(String fileId);
+ StoragePath storageLocation(String path, String instantTime);
/**
- * Return a storage location for the given partition and filename.
+ * Return all possible StoragePaths
*
- * @param partitionPath partition path for the file
- * @param fileId data file ID
- * @return a storage location string for a data file
+ * @param partitionPath
+ * @param checkExist check if StoragePath is truly existed or not.
+ * @return a st of storage partition path
+ */
+ Set<StoragePath> getAllLocations(String partitionPath, boolean checkExist);
+
+ /**
+ * Return RelativePath base on path and locations.
+ *
+ * @param path
+ * @return relative path
+ */
+ String getRelativePath(Path path);
+}
+```
+
+```java
+public class HoodieStorageStrategyFactory {
+ private HoodieStorageStrategyFactory() {
+ }
+
+ public static HoodieStorageStrategy getInstant(HoodieTableMetaClient
metaClient, Boolean reset) {
+ HoodieTableConfig config = metaClient.getTableConfig();
+ if (reset) {
+ return getInstant(HoodieStorageStrategyType.DEFAULT.value,
metaClient.getBasePath(), config.getStoragePath(), metaClient);
+ }
+ return getInstant(config.getStorageStrategy(), metaClient.getBasePath(),
config.getStoragePath(), metaClient);
+ }
+
+ public static HoodieStorageStrategy getInstant(HoodieTableMetaClient
metaClient) {
+ return getInstant(metaClient, false);
+ }
+
+ /**
+ * Just for HoodieParquetInputFormatBase
+ * @param config
+ * @param basePath
+ * @return
*/
- String storageLocation(String partitionPath, String fileId);
+ public static HoodieStorageStrategy getInstant(HoodieTableConfig config,
String basePath, Boolean reset) {
+ if (reset) {
+ return getInstant(HoodieStorageStrategyType.DEFAULT.value, basePath,
config.getStoragePath(), null);
+ }
+ return getInstant(config.getStorageStrategy(), basePath,
config.getStoragePath(), null);
+ }
+
+ private static HoodieStorageStrategy getInstant(
+ String storageStrategyClass,
+ String basePath,
+ String storagePath, HoodieTableMetaClient metaClient) {
+ return (HoodieStorageStrategy)
ReflectionUtils.loadClass(storageStrategyClass,
+ basePath, storagePath, metaClient == null ? Option.empty() :
Option.of(metaClient));
+ }
}
```
-### Generating File Paths for Object Store Optimized Layout
+```java
+public enum HoodieStorageStrategyType {
Review Comment:
done
--
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]