[
https://issues.apache.org/jira/browse/HADOOP-19187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17851591#comment-17851591
]
ASF GitHub Bot commented on HADOOP-19187:
-----------------------------------------
saxenapranav commented on code in PR #6846:
URL: https://github.com/apache/hadoop/pull/6846#discussion_r1624280747
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClientHandler.java:
##########
@@ -0,0 +1,68 @@
+/**
+ * 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.hadoop.fs.azurebfs.services;
+
+import org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType;
+import org.apache.hadoop.util.Preconditions;
+
+/**
+ * AbfsClientHandler is a class that provides a way to get the AbfsClient
+ * based on the service type.
+ */
+public class AbfsClientHandler {
+ private final AbfsServiceType defaultServiceType;
+ private final AbfsClient dfsAbfsClient;
+ private final AbfsClient blobAbfsClient;
+
+ public AbfsClientHandler(AbfsServiceType defaultServiceType,
+ AbfsClient dfsAbfsClient, AbfsClient blobAbfsClient) {
+ this.blobAbfsClient = blobAbfsClient;
+ this.dfsAbfsClient = dfsAbfsClient;
+ this.defaultServiceType = defaultServiceType;
+ }
+
+ public AbfsClient getClient() {
+ if (defaultServiceType == AbfsServiceType.DFS) {
+ Preconditions.checkNotNull(dfsAbfsClient, "DFS client is not
initialized");
+ return dfsAbfsClient;
+ } else {
+ Preconditions.checkNotNull(dfsAbfsClient, "Blob client is not
initialized");
+ return blobAbfsClient;
+ }
+ }
+
+ public AbfsClient getClient(AbfsServiceType serviceType) {
+ if (serviceType == AbfsServiceType.DFS) {
+ Preconditions.checkNotNull(dfsAbfsClient, "DFS client is not
initialized");
+ return dfsAbfsClient;
+ } else {
+ Preconditions.checkNotNull(dfsAbfsClient, "Blob client is not
initialized");
+ return blobAbfsClient;
+ }
+ }
+
+ public AbfsDfsClient getDfsClient() {
+ Preconditions.checkNotNull(dfsAbfsClient, "DFS client is not initialized");
+ return (AbfsDfsClient) dfsAbfsClient;
+ }
+
+ public AbfsBlobClient getBlobClient() {
+ Preconditions.checkNotNull(blobAbfsClient, "Blob client is not
initialized");
+ return (AbfsBlobClient) blobAbfsClient;
Review Comment:
we can directly have fields of AbfsBlobClient and AbfsDfsClient, this would
remove need of runtime casting.
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java:
##########
@@ -284,9 +293,26 @@ public AzureBlobFileSystemStore(
"abfs-bounded");
}
+ public void validateConfiguredServiceType(TracingContext tracingContext)
+ throws AzureBlobFileSystemException {
+ // Todo: [FnsOverBlob] - Remove this check, Failing FS Init with Blob
Endpoint Until FNS over Blob is ready.
+ if (getConfiguredServiceType() == AbfsServiceType.BLOB) {
+ throw new InvalidConfigurationValueException(FS_DEFAULT_NAME_KEY);
Review Comment:
we should also inform what is wrong with the config.
> ABFS: Making AbfsClient Abstract for supporting both DFS and Blob Endpoint
> --------------------------------------------------------------------------
>
> Key: HADOOP-19187
> URL: https://issues.apache.org/jira/browse/HADOOP-19187
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs/azure
> Affects Versions: 3.4.0
> Reporter: Anuj Modi
> Assignee: Anuj Modi
> Priority: Major
> Labels: pull-request-available
> Fix For: 3.5.0, 3.4.1
>
>
> Azure Services support two different set of APIs.
> Blob:
> [https://learn.microsoft.com/en-us/rest/api/storageservices/blob-service-rest-api]
>
> DFS:
> [https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/operation-groups]
>
> As per the plan in HADOOP-19179, this task enables ABFS Driver to work with
> both set of APIs as per the requirement.
> Scope of this task is to refactor the ABfsClient so that ABFSStore can choose
> to interact with the client it wants based on the endpoint configured by user.
> The blob endpoint support will remain "Unsupported" until the whole code is
> checked-in and well tested.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]