-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* DataLakeFileClient add openInputStream() * datalake inputstream tests added tests removed unncecessary openinputstream overload * changelog * Fixed blob artifacts from feature port Fixed docstrings and parameters that used "blob" instead of "file" terminology. Fixed a docstring link that referenced cut blob-only functionality. * FileInputStream fix and docs issues DataLakeFileInputStream now uses logger.logThrowableAsError. Header and docstring fixes. * Casts throwable to match checked exception type * CI fixes * fixes * checkstyle added a suppression to deal with a checkstyle bug minor fixes * Refactored StorageInputStream StorageInputStream now has an implementation of dispatchRead() and only delegates out the implementation of the client read operation itself. * checkstyle suppression and pr feedback * PR feedback * import cleanup * Undo abstract method shifting * import cleanup * imports and checkstyle supression to match blobs * minor fixes * PR comments * docstring * api rewrite openInputStream returns a result class containing InputStream and PathProperties members. The returned InputStream is a BlobInputStream instance. Ported blob inputStream test class * PR feedback * Styling * reverted *Result type implements Closable * cleanup imports Co-authored-by: jschrepp-MSFT <[email protected]>
- Loading branch information
1 parent
70e7db4
commit e603f6a
Showing
27 changed files
with
4,185 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...torage/file/datalake/implementation/models/InternalDataLakeFileOpenInputStreamResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.storage.file.datalake.implementation.models; | ||
|
||
import com.azure.storage.file.datalake.models.DataLakeFileOpenInputStreamResult; | ||
import com.azure.storage.file.datalake.models.PathProperties; | ||
|
||
import java.io.InputStream; | ||
|
||
public class InternalDataLakeFileOpenInputStreamResult implements DataLakeFileOpenInputStreamResult { | ||
|
||
private final InputStream inputStream; | ||
private final PathProperties properties; | ||
|
||
public InternalDataLakeFileOpenInputStreamResult(InputStream inputStream, PathProperties properties) { | ||
this.inputStream = inputStream; | ||
this.properties = properties; | ||
} | ||
|
||
@Override | ||
public InputStream getInputStream() { | ||
return inputStream; | ||
} | ||
|
||
@Override | ||
public PathProperties getProperties() { | ||
return properties; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...-datalake/src/main/java/com/azure/storage/file/datalake/models/ConsistentReadControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.storage.file.datalake.models; | ||
|
||
/** | ||
* Defines values to indicate what strategy the SDK should use when reading from a blob to ensure the view of the data | ||
* is consistent and not changed during the read. | ||
*/ | ||
public enum ConsistentReadControl { | ||
/** | ||
* No consistent read control. The client will honor user provided {@link DataLakeRequestConditions#getIfMatch()} | ||
*/ | ||
NONE, | ||
|
||
/** | ||
* Default value. Consistent read control based on eTag. | ||
* If {@link DataLakeRequestConditions#getIfMatch()} is set, the client will honor this value. | ||
* Otherwise, {@link DataLakeRequestConditions#getIfMatch()} is set to the latest eTag. | ||
* Note: Modification of the base blob will result in an {@code IOException} or a {@code BlobStorageException} if | ||
* eTag is the only form of consistent read control being employed. | ||
*/ | ||
ETAG, | ||
} |
21 changes: 21 additions & 0 deletions
21
...c/main/java/com/azure/storage/file/datalake/models/DataLakeFileOpenInputStreamResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.storage.file.datalake.models; | ||
|
||
import java.io.InputStream; | ||
|
||
/** | ||
* Result of opening an {@link InputStream} to a datalake file. | ||
*/ | ||
public interface DataLakeFileOpenInputStreamResult { | ||
/** | ||
* @return the {@link InputStream} of the target file. | ||
*/ | ||
InputStream getInputStream(); | ||
|
||
/** | ||
* @return the {@link PathProperties} of the target file. | ||
*/ | ||
PathProperties getProperties(); | ||
} |
89 changes: 89 additions & 0 deletions
89
...src/main/java/com/azure/storage/file/datalake/options/DataLakeFileInputStreamOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.storage.file.datalake.options; | ||
|
||
import com.azure.core.annotation.Fluent; | ||
import com.azure.storage.file.datalake.models.ConsistentReadControl; | ||
import com.azure.storage.file.datalake.models.DataLakeRequestConditions; | ||
import com.azure.storage.file.datalake.models.FileRange; | ||
|
||
/** | ||
* Extended options that may be passed when opening a blob input stream. | ||
*/ | ||
@Fluent | ||
public class DataLakeFileInputStreamOptions { | ||
|
||
private FileRange range; | ||
private DataLakeRequestConditions requestConditions; | ||
private Integer blockSize; | ||
private ConsistentReadControl consistentReadControl; | ||
|
||
/** | ||
* @return {@link FileRange} | ||
*/ | ||
public FileRange getRange() { | ||
return range; | ||
} | ||
|
||
/** | ||
* @param range {@link FileRange} | ||
* @return The updated options. | ||
*/ | ||
public DataLakeFileInputStreamOptions setRange(FileRange range) { | ||
this.range = range; | ||
return this; | ||
} | ||
|
||
/** | ||
* @return {@link DataLakeRequestConditions} | ||
*/ | ||
public DataLakeRequestConditions getRequestConditions() { | ||
return requestConditions; | ||
} | ||
|
||
/** | ||
* @param requestConditions {@link DataLakeRequestConditions} | ||
* @return The updated options. | ||
*/ | ||
public DataLakeFileInputStreamOptions setRequestConditions(DataLakeRequestConditions requestConditions) { | ||
this.requestConditions = requestConditions; | ||
return this; | ||
} | ||
|
||
/** | ||
* @return The size of each data chunk returned from the service. If block size is large, input stream will make | ||
* fewer network calls, but each individual call will send more data and will therefore take longer. | ||
* The default value is 4 MB. | ||
*/ | ||
public Integer getBlockSize() { | ||
return blockSize; | ||
} | ||
|
||
/** | ||
* @param blockSize The size of each data chunk returned from the service. If block size is large, input stream | ||
* will make fewer network calls, but each individual call will send more data and will therefore take longer. | ||
* The default value is 4 MB. | ||
* @return The updated options. | ||
*/ | ||
public DataLakeFileInputStreamOptions setBlockSize(Integer blockSize) { | ||
this.blockSize = blockSize; | ||
return this; | ||
} | ||
|
||
/** | ||
* @return {@link ConsistentReadControl} Default is E-Tag. | ||
*/ | ||
public ConsistentReadControl getConsistentReadControl() { | ||
return consistentReadControl; | ||
} | ||
|
||
/** | ||
* @param consistentReadControl {@link ConsistentReadControl} Default is E-Tag. | ||
* @return The updated options. | ||
*/ | ||
public DataLakeFileInputStreamOptions setConsistentReadControl(ConsistentReadControl consistentReadControl) { | ||
this.consistentReadControl = consistentReadControl; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.