Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
files="org[\\/]apache[\\/]hadoop[\\/]fs[\\/]azurebfs[\\/]AzureBlobFileSystemStore.java"/>
<suppress checks="ParameterNumber"
files="org[\\/]apache[\\/]hadoop[\\/]fs[\\/]azurebfs[\\/]services[\\/]AbfsClient.java"/>
<suppress checks="ParameterNumber"
files="org[\\/]apache[\\/]hadoop[\\/]fs[\\/]azurebfs[\\/]services[\\/]AbfsBlobClient.java"/>
<suppress checks="ParameterNumber"
files="org[\\/]apache[\\/]hadoop[\\/]fs[\\/]azurebfs[\\/]contracts[\\/]services[\\/]AppendRequestParameters.java"/>
<suppress checks="ParameterNumber|MagicNumber"
files="org[\\/]apache[\\/]hadoop[\\/]fs[\\/]azurebfs[\\/]utils[\\/]Base64.java"/>
<suppress checks="ParameterNumber|VisibilityModifier"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ private boolean fileSystemExists() throws IOException {
try {
checkException(null, ex);
// Because HEAD request won't contain message body,
// there is not way to get the storage error code
// there is no way to get the storage error code
// workaround here is to check its status code.
} catch (FileNotFoundException e) {
statIncrement(ERROR_IGNORED);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ public final class AbfsHttpConstants {
public static final String DEFAULT_LEASE_BREAK_PERIOD = "0";
public static final String DEFAULT_TIMEOUT = "90";
public static final String APPEND_BLOB_TYPE = "appendblob";
public static final String TOKEN_VERSION = "2";

//Abfs Http Client Constants for Blob Endpoint APIs.
public static final String CONTAINER = "container";
public static final String METADATA = "metadata";
public static final String LIST = "list";
public static final String BLOCK = "block";
public static final String BLOCKLIST = "blocklist";
public static final String LEASE = "lease";
public static final String BLOCK_BLOB_TYPE = "BlockBlob";
public static final String BLOCK_TYPE_COMMITTED = "committed";

public static final String JAVA_VENDOR = "java.vendor";
public static final String JAVA_VERSION = "java.version";
Expand All @@ -60,6 +69,7 @@ public final class AbfsHttpConstants {

public static final String APN_VERSION = "APN/1.0";
public static final String CLIENT_VERSION = "Azure Blob FS/" + VersionInfo.getVersion();
public static final String TOKEN_VERSION = "2";

// Abfs Http Verb
public static final String HTTP_METHOD_DELETE = "DELETE";
Expand Down Expand Up @@ -92,6 +102,7 @@ public final class AbfsHttpConstants {
public static final String HTTP_HEADER_PREFIX = "x-ms-";
public static final String HASH = "#";
public static final String TRUE = "true";
public static final String ZERO = "0";

public static final String PLUS_ENCODE = "%20";
public static final String FORWARD_SLASH_ENCODE = "%2F";
Expand All @@ -101,6 +112,7 @@ public final class AbfsHttpConstants {
public static final String GMT_TIMEZONE = "GMT";
public static final String APPLICATION_JSON = "application/json";
public static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
public static final String APPLICATION_XML = "application/xml";
public static final String XMS_PROPERTIES_ENCODING_ASCII = "ISO-8859-1";
public static final String XMS_PROPERTIES_ENCODING_UNICODE = "UTF-8";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public enum FSOperationType {
SET_OWNER("SO"),
SET_ACL("SA"),
TEST_OP("TS"),
WRITE("WR"),
INIT("IN");
WRITE("WR");

private final String opCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ public final class HttpHeaderConfigurations {
public static final String X_MS_LEASE_ACTION = "x-ms-lease-action";
public static final String X_MS_LEASE_DURATION = "x-ms-lease-duration";
public static final String X_MS_LEASE_ID = "x-ms-lease-id";
public static final String X_MS_SOURCE_LEASE_ID = "x-ms-source-lease-id";
public static final String X_MS_PROPOSED_LEASE_ID = "x-ms-proposed-lease-id";
public static final String X_MS_LEASE_BREAK_PERIOD = "x-ms-lease-break-period";
public static final String EXPECT = "Expect";
public static final String X_MS_RANGE_GET_CONTENT_MD5 = "x-ms-range-get-content-md5";
public static final String X_MS_BLOB_TYPE = "x-ms-blob-type";
public static final String X_MS_META_HDI_ISFOLDER = "x-ms-meta-hdi_isfolder";
public static final String X_MS_METADATA_PREFIX = "x-ms-meta-";
public static final String X_MS_COPY_SOURCE = "x-ms-copy-source";
public static final String X_MS_BLOB_CONTENT_MD5 = "x-ms-blob-content-md5";

private HttpHeaderConfigurations() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ public final class HttpQueryParams {
public static final String QUERY_PARAM_BLOBTYPE = "blobtype";
public static final String QUERY_PARAM_PAGINATED = "paginated";

// query parameters for Blob Endpoint Rest APIs
public static final String QUERY_PARAM_RESTYPE = "restype";
public static final String QUERY_PARAM_COMP = "comp";
public static final String QUERY_PARAM_INCLUDE = "include";
public static final String QUERY_PARAM_PREFIX = "prefix";
public static final String QUERY_PARAM_MARKER = "marker";
public static final String QUERY_PARAM_DELIMITER = "delimiter";
public static final String QUERY_PARAM_MAX_RESULTS = "maxresults";
public static final String QUERY_PARAM_BLOCKID = "blockid";
public static final String QUERY_PARAM_BLOCKLISTTYPE = "blocklisttype";

//query params for SAS
public static final String QUERY_PARAM_SAOID = "saoid";
public static final String QUERY_PARAM_SKOID = "skoid";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public enum Mode {
private final String leaseId;
private boolean isExpectHeaderEnabled;
private boolean isRetryDueToExpect;
private BlobAppendRequestParameters blobParams;

// Constructor to be used for interacting with AbfsDfsClient
public AppendRequestParameters(final long position,
final int offset,
final int length,
Expand All @@ -52,6 +54,27 @@ public AppendRequestParameters(final long position,
this.leaseId = leaseId;
this.isExpectHeaderEnabled = isExpectHeaderEnabled;
this.isRetryDueToExpect = false;
this.blobParams = null;
}

// Constructor to be used for interacting with AbfsBlobClient
public AppendRequestParameters(final long position,
final int offset,
final int length,
final Mode mode,
final boolean isAppendBlob,
final String leaseId,
final boolean isExpectHeaderEnabled,
final BlobAppendRequestParameters blobParams) {
this.position = position;
this.offset = offset;
this.length = length;
this.mode = mode;
this.isAppendBlob = isAppendBlob;
this.leaseId = leaseId;
this.isExpectHeaderEnabled = isExpectHeaderEnabled;
this.isRetryDueToExpect = false;
this.blobParams = blobParams;
}

public long getPosition() {
Expand Down Expand Up @@ -86,6 +109,22 @@ public boolean isRetryDueToExpect() {
return isRetryDueToExpect;
}

/**
* Returns BlockId of the block blob to be appended.
* @return blockId
*/
public String getBlockId() {
return blobParams.getBlockId();
}

/**
* Returns ETag of the block blob.
* @return eTag
*/
public String getETag() {
return blobParams.getETag();
}

public void setRetryDueToExpect(boolean retryDueToExpect) {
isRetryDueToExpect = retryDueToExpect;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
public enum AzureServiceErrorCode {
FILE_SYSTEM_ALREADY_EXISTS("FilesystemAlreadyExists", HttpURLConnection.HTTP_CONFLICT, null),
PATH_ALREADY_EXISTS("PathAlreadyExists", HttpURLConnection.HTTP_CONFLICT, null),
BLOB_ALREADY_EXISTS("BlobAlreadyExists", HttpURLConnection.HTTP_CONFLICT, null),
INTERNAL_OPERATION_ABORT("InternalOperationAbortError", HttpURLConnection.HTTP_CONFLICT, null),
PATH_CONFLICT("PathConflict", HttpURLConnection.HTTP_CONFLICT, null),
FILE_SYSTEM_NOT_FOUND("FilesystemNotFound", HttpURLConnection.HTTP_NOT_FOUND, null),
PATH_NOT_FOUND("PathNotFound", HttpURLConnection.HTTP_NOT_FOUND, null),
BLOB_PATH_NOT_FOUND("BlobNotFound", HttpURLConnection.HTTP_NOT_FOUND, null),
PRE_CONDITION_FAILED("PreconditionFailed", HttpURLConnection.HTTP_PRECON_FAILED, null),
SOURCE_PATH_NOT_FOUND("SourcePathNotFound", HttpURLConnection.HTTP_NOT_FOUND, null),
INVALID_SOURCE_OR_DESTINATION_RESOURCE_TYPE("InvalidSourceOrDestinationResourceType", HttpURLConnection.HTTP_CONFLICT, null),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* 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.contracts.services;

/**
* Following parameters are used by AbfsBlobClient only.
* Blob Endpoint Append API requires blockId and eTag to be passed in the request.
*/
public class BlobAppendRequestParameters {
private String blockId;
private String eTag;

public BlobAppendRequestParameters(String blockId, String eTag) {
this.blockId = blockId;
this.eTag = eTag;
}

public String getBlockId() {
return blockId;
}

public String getETag() {
return eTag;
}
}
Loading