java.io.Closeable, java.lang.AutoCloseablepublic class AbfsClient
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
HUNDRED_CONTINUE_USER_AGENT |
|
static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
AbfsClient(java.net.URL baseUrl,
SharedKeyCredentials sharedKeyCredentials,
AbfsConfiguration abfsConfiguration,
SASTokenProvider sasTokenProvider,
EncryptionContextProvider encryptionContextProvider,
AbfsClientContext abfsClientContext) |
|
AbfsClient(java.net.URL baseUrl,
SharedKeyCredentials sharedKeyCredentials,
AbfsConfiguration abfsConfiguration,
AccessTokenProvider tokenProvider,
EncryptionContextProvider encryptionContextProvider,
AbfsClientContext abfsClientContext) |
| Modifier and Type | Method | Description |
|---|---|---|
AbfsRestOperation |
acquireLease(java.lang.String path,
int duration,
TracingContext tracingContext) |
|
<V> void |
addCallback(org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ListenableFuture<V> future,
org.apache.hadoop.thirdparty.com.google.common.util.concurrent.FutureCallback<V> callback) |
|
AbfsRestOperation |
append(java.lang.String path,
byte[] buffer,
AppendRequestParameters reqParams,
java.lang.String cachedSasToken,
ContextEncryptionAdapter contextEncryptionAdapter,
TracingContext tracingContext) |
|
boolean |
appendSuccessCheckOp(AbfsRestOperation op,
java.lang.String path,
long length,
TracingContext tracingContext) |
|
AbfsRestOperation |
breakLease(java.lang.String path,
TracingContext tracingContext) |
|
AbfsRestOperation |
checkAccess(java.lang.String path,
java.lang.String rwx,
TracingContext tracingContext) |
Talks to the server to check whether the permission specified in
the rwx parameter is present for the path specified in the path parameter.
|
void |
close() |
|
java.lang.String |
computeMD5Hash(byte[] data,
int off,
int len) |
Compute MD5Hash of the given byte array starting from given offset up to given length.
|
protected java.util.List<AbfsHttpHeader> |
createDefaultHeaders() |
Create request headers for Rest Operation using the current API version.
|
AbfsRestOperation |
createFilesystem(TracingContext tracingContext) |
|
AbfsRestOperation |
createPath(java.lang.String path,
boolean isFile,
boolean overwrite,
AzureBlobFileSystemStore.Permissions permissions,
boolean isAppendBlob,
java.lang.String eTag,
ContextEncryptionAdapter contextEncryptionAdapter,
TracingContext tracingContext) |
Method for calling createPath API to the backend.
|
protected java.net.URL |
createRequestUrl(java.lang.String path,
java.lang.String query) |
|
AbfsRestOperation |
deleteFilesystem(TracingContext tracingContext) |
|
AbfsRestOperation |
deleteIdempotencyCheckOp(AbfsRestOperation op) |
Check if the delete request failure is post a retry and if delete failure
qualifies to be a success response assuming idempotency.
|
AbfsRestOperation |
deletePath(java.lang.String path,
boolean recursive,
java.lang.String continuation,
TracingContext tracingContext,
boolean isNamespaceEnabled) |
|
AbfsRestOperation |
flush(java.lang.String path,
long position,
boolean retainUncommittedData,
boolean isClose,
java.lang.String cachedSasToken,
java.lang.String leaseId,
ContextEncryptionAdapter contextEncryptionAdapter,
TracingContext tracingContext) |
|
protected AbfsConfiguration |
getAbfsConfiguration() |
Getter for abfsConfiguration from AbfsClient.
|
protected AbfsCounters |
getAbfsCounters() |
Getter for abfsCounters from AbfsClient.
|
protected AbfsPerfTracker |
getAbfsPerfTracker() |
|
java.lang.String |
getAccessToken() |
|
AbfsRestOperation |
getAclStatus(java.lang.String path,
boolean useUPN,
TracingContext tracingContext) |
|
AbfsRestOperation |
getAclStatus(java.lang.String path,
TracingContext tracingContext) |
|
AuthType |
getAuthType() |
|
static java.lang.String |
getDirectoryQueryParameter(java.lang.String path) |
Get the directory query parameter used by the List Paths REST API and used
as the path in the continuation token.
|
EncryptionContextProvider |
getEncryptionContextProvider() |
|
EncryptionType |
getEncryptionType() |
|
java.lang.String |
getFileSystem() |
|
AbfsRestOperation |
getFilesystemProperties(TracingContext tracingContext) |
|
protected java.lang.Boolean |
getIsPaginatedDeleteEnabled() |
|
int |
getNumLeaseThreads() |
|
AbfsRestOperation |
getPathStatus(java.lang.String path,
boolean includeProperties,
TracingContext tracingContext,
ContextEncryptionAdapter contextEncryptionAdapter) |
|
AbfsRetryPolicy |
getRetryPolicy(java.lang.String failureReason) |
Returns the retry policy to be used for Abfs Rest Operation Failure.
|
SASTokenProvider |
getSasTokenProvider() |
|
protected AccessTokenProvider |
getTokenProvider() |
|
AbfsHttpConstants.ApiVersion |
getxMsVersion() |
|
AbfsRestOperation |
listPath(java.lang.String relativePath,
boolean recursive,
int listMaxResults,
java.lang.String continuation,
TracingContext tracingContext) |
|
AbfsRestOperation |
read(java.lang.String path,
long position,
byte[] buffer,
int bufferOffset,
int bufferLength,
java.lang.String eTag,
java.lang.String cachedSasToken,
ContextEncryptionAdapter contextEncryptionAdapter,
TracingContext tracingContext) |
|
AbfsRestOperation |
releaseLease(java.lang.String path,
java.lang.String leaseId,
TracingContext tracingContext) |
|
boolean |
renameIdempotencyCheckOp(java.lang.String source,
java.lang.String sourceEtag,
AbfsRestOperation op,
java.lang.String destination,
TracingContext tracingContext) |
Check if the rename request failure is post a retry and if earlier rename
request might have succeeded at back-end.
|
AbfsClientRenameResult |
renamePath(java.lang.String source,
java.lang.String destination,
java.lang.String continuation,
TracingContext tracingContext,
java.lang.String sourceEtag,
boolean isMetadataIncompleteState,
boolean isNamespaceEnabled) |
Rename a file or directory.
|
AbfsRestOperation |
renewLease(java.lang.String path,
java.lang.String leaseId,
TracingContext tracingContext) |
|
<V> org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ListenableScheduledFuture<V> |
schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit timeUnit) |
|
AbfsRestOperation |
setAcl(java.lang.String path,
java.lang.String aclSpecString,
java.lang.String eTag,
TracingContext tracingContext) |
|
AbfsRestOperation |
setAcl(java.lang.String path,
java.lang.String aclSpecString,
TracingContext tracingContext) |
|
void |
setEncryptionType(EncryptionType encryptionType) |
|
AbfsRestOperation |
setFilesystemProperties(java.lang.String properties,
TracingContext tracingContext) |
|
AbfsRestOperation |
setOwner(java.lang.String path,
java.lang.String owner,
java.lang.String group,
TracingContext tracingContext) |
|
AbfsRestOperation |
setPathProperties(java.lang.String path,
java.lang.String properties,
TracingContext tracingContext,
ContextEncryptionAdapter contextEncryptionAdapter) |
|
AbfsRestOperation |
setPermission(java.lang.String path,
java.lang.String permission,
TracingContext tracingContext) |
|
org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ListenableFuture<?> |
submit(java.lang.Runnable runnable) |
|
static java.lang.String |
urlEncode(java.lang.String value) |
public static final org.slf4j.Logger LOG
public static final java.lang.String HUNDRED_CONTINUE_USER_AGENT
public AbfsClient(java.net.URL baseUrl,
SharedKeyCredentials sharedKeyCredentials,
AbfsConfiguration abfsConfiguration,
AccessTokenProvider tokenProvider,
EncryptionContextProvider encryptionContextProvider,
AbfsClientContext abfsClientContext)
throws java.io.IOException
java.io.IOExceptionpublic AbfsClient(java.net.URL baseUrl,
SharedKeyCredentials sharedKeyCredentials,
AbfsConfiguration abfsConfiguration,
SASTokenProvider sasTokenProvider,
EncryptionContextProvider encryptionContextProvider,
AbfsClientContext abfsClientContext)
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOExceptionpublic java.lang.String getFileSystem()
protected AbfsPerfTracker getAbfsPerfTracker()
public AbfsRetryPolicy getRetryPolicy(java.lang.String failureReason)
failureReason - helps to decide which type of retryPolicy to be used.public void setEncryptionType(EncryptionType encryptionType)
public EncryptionType getEncryptionType()
@VisibleForTesting protected java.util.List<AbfsHttpHeader> createDefaultHeaders()
public AbfsRestOperation createFilesystem(TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation setFilesystemProperties(java.lang.String properties, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation listPath(java.lang.String relativePath, boolean recursive, int listMaxResults, java.lang.String continuation, TracingContext tracingContext) throws java.io.IOException
java.io.IOExceptionpublic AbfsRestOperation getFilesystemProperties(TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation deleteFilesystem(TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation createPath(java.lang.String path, boolean isFile, boolean overwrite, AzureBlobFileSystemStore.Permissions permissions, boolean isAppendBlob, java.lang.String eTag, ContextEncryptionAdapter contextEncryptionAdapter, TracingContext tracingContext) throws AzureBlobFileSystemException
path - : path of the file / directory to be created / overwritten.isFile - : defines if file or directory has to be created / overwritten.overwrite - : defines if the file / directory to be overwritten.permissions - : contains permission and umaskisAppendBlob - : defines if directory in the path is enabled for appendBlobeTag - : required in case of overwrite of file / directory. Path would be
overwritten only if the provided eTag is equal to the one present in backend for
the path.contextEncryptionAdapter - : object that contains the encryptionContext and
encryptionKey created from the developer provided implementation of
EncryptionContextProvidertracingContext - : Object of TracingContext
correlating to the current fs.create() request.AbfsRestOperation which contain all the information
about the communication with the server. The information is in
AbfsRestOperation.getResult()AzureBlobFileSystemException - throws back the exception it receives from the
AbfsRestOperation.execute(TracingContext) method call.public AbfsRestOperation acquireLease(java.lang.String path, int duration, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation renewLease(java.lang.String path, java.lang.String leaseId, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation releaseLease(java.lang.String path, java.lang.String leaseId, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation breakLease(java.lang.String path, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsClientRenameResult renamePath(java.lang.String source, java.lang.String destination, java.lang.String continuation, TracingContext tracingContext, java.lang.String sourceEtag, boolean isMetadataIncompleteState, boolean isNamespaceEnabled) throws java.io.IOException
source - path to source filedestination - destination of rename.continuation - continuation.tracingContext - trace contextsourceEtag - etag of source file. may be null or emptyisMetadataIncompleteState - was there a rename failure due to
incomplete metadata state?isNamespaceEnabled - whether namespace enabled account or notAzureBlobFileSystemException - failure, excluding any recovery from overload failures.java.io.IOExceptionpublic boolean renameIdempotencyCheckOp(java.lang.String source,
java.lang.String sourceEtag,
AbfsRestOperation op,
java.lang.String destination,
TracingContext tracingContext)
source - source pathop - Rename request REST operation response with non-null HTTP responsedestination - rename destination pathsourceEtag - etag of source file. may be null or emptytracingContext - Tracks identifiers for request headerpublic AbfsRestOperation append(java.lang.String path, byte[] buffer, AppendRequestParameters reqParams, java.lang.String cachedSasToken, ContextEncryptionAdapter contextEncryptionAdapter, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic boolean appendSuccessCheckOp(AbfsRestOperation op, java.lang.String path, long length, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation flush(java.lang.String path, long position, boolean retainUncommittedData, boolean isClose, java.lang.String cachedSasToken, java.lang.String leaseId, ContextEncryptionAdapter contextEncryptionAdapter, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation setPathProperties(java.lang.String path, java.lang.String properties, TracingContext tracingContext, ContextEncryptionAdapter contextEncryptionAdapter) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation getPathStatus(java.lang.String path, boolean includeProperties, TracingContext tracingContext, ContextEncryptionAdapter contextEncryptionAdapter) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation read(java.lang.String path, long position, byte[] buffer, int bufferOffset, int bufferLength, java.lang.String eTag, java.lang.String cachedSasToken, ContextEncryptionAdapter contextEncryptionAdapter, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation deletePath(java.lang.String path, boolean recursive, java.lang.String continuation, TracingContext tracingContext, boolean isNamespaceEnabled) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation deleteIdempotencyCheckOp(AbfsRestOperation op)
op - Delete request REST operation response with non-null HTTP responsepublic AbfsRestOperation setOwner(java.lang.String path, java.lang.String owner, java.lang.String group, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation setPermission(java.lang.String path, java.lang.String permission, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation setAcl(java.lang.String path, java.lang.String aclSpecString, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation setAcl(java.lang.String path, java.lang.String aclSpecString, java.lang.String eTag, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation getAclStatus(java.lang.String path, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation getAclStatus(java.lang.String path, boolean useUPN, TracingContext tracingContext) throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic AbfsRestOperation checkAccess(java.lang.String path, java.lang.String rwx, TracingContext tracingContext) throws AzureBlobFileSystemException
path - Path for which access check needs to be performedrwx - The permission to be checked on the pathtracingContext - Tracks identifiers for request headerAbfsRestOperation object for the operationAzureBlobFileSystemException - in case of bad requestspublic static java.lang.String getDirectoryQueryParameter(java.lang.String path)
path - the path to be listed.@VisibleForTesting
protected java.net.URL createRequestUrl(java.lang.String path,
java.lang.String query)
throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic static java.lang.String urlEncode(java.lang.String value)
throws AzureBlobFileSystemException
AzureBlobFileSystemExceptionpublic java.lang.String getAccessToken()
throws java.io.IOException
java.io.IOExceptionprotected java.lang.Boolean getIsPaginatedDeleteEnabled()
public AuthType getAuthType()
public EncryptionContextProvider getEncryptionContextProvider()
@VisibleForTesting
public java.lang.String computeMD5Hash(byte[] data,
int off,
int len)
throws AbfsRestOperationException
data - byte array from which data is fetched to compute MD5 Hash.off - offset in the array from where actual data starts.len - length of the data to be used to compute MD5Hash.AbfsRestOperationException - if computation fails.@VisibleForTesting public SASTokenProvider getSasTokenProvider()
protected AbfsCounters getAbfsCounters()
public AbfsHttpConstants.ApiVersion getxMsVersion()
protected AbfsConfiguration getAbfsConfiguration()
public int getNumLeaseThreads()
public <V> org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ListenableScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit timeUnit)
public org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ListenableFuture<?> submit(java.lang.Runnable runnable)
public <V> void addCallback(org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ListenableFuture<V> future,
org.apache.hadoop.thirdparty.com.google.common.util.concurrent.FutureCallback<V> callback)
@VisibleForTesting protected AccessTokenProvider getTokenProvider()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.