forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kunal Kotwani <[email protected]>
- Loading branch information
1 parent
57d5e90
commit de65295
Showing
16 changed files
with
646 additions
and
27 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
83 changes: 83 additions & 0 deletions
83
server/src/main/java/org/opensearch/common/blobstore/stream/read/ReadContext.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,83 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.blobstore.stream.read; | ||
|
||
import org.apache.lucene.store.Directory; | ||
import org.opensearch.common.CheckedConsumer; | ||
import org.opensearch.common.Nullable; | ||
import org.opensearch.common.StreamContext; | ||
import org.opensearch.common.blobstore.stream.write.StreamContextSupplier; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* WriteContext is used to encapsulate all data needed by <code>BlobContainer#readStreams</code> | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class ReadContext { | ||
|
||
private final String fileName; | ||
private final String remoteFileName; | ||
private final CheckedConsumer<Boolean, IOException> downloadFinalizer; | ||
private final boolean doRemoteDataIntegrityCheck; | ||
private Directory localDirectory; | ||
|
||
/** | ||
* Construct a new WriteContext object | ||
* | ||
* @param fileName The name of the file being downloaded | ||
* @param doRemoteDataIntegrityCheck A boolean to inform vendor plugins whether remote data integrity checks need to be done | ||
*/ | ||
public ReadContext( | ||
String remoteFileName, | ||
String fileName, | ||
CheckedConsumer<Boolean, IOException> downloadFinalizer, | ||
boolean doRemoteDataIntegrityCheck | ||
) { | ||
this.remoteFileName = remoteFileName; | ||
this.fileName = fileName; | ||
this.downloadFinalizer = downloadFinalizer; | ||
this.doRemoteDataIntegrityCheck = doRemoteDataIntegrityCheck; | ||
} | ||
|
||
public void setLocalDirectory(Directory directory) { | ||
this.localDirectory = directory; | ||
} | ||
|
||
public Directory getLocalDirectory() { | ||
return this.localDirectory; | ||
} | ||
|
||
/** | ||
* @return The file name | ||
*/ | ||
public String getFileName() { | ||
return fileName; | ||
} | ||
|
||
public String getRemoteFileName() { | ||
return remoteFileName; | ||
} | ||
|
||
/** | ||
* @return The <code>UploadFinalizer</code> for this upload | ||
*/ | ||
public CheckedConsumer<Boolean, IOException> getDownloadFinalizer() { | ||
return downloadFinalizer; | ||
} | ||
|
||
/** | ||
* @return A boolean for whether remote data integrity check has to be done for this upload or not | ||
*/ | ||
public boolean doRemoteDataIntegrityCheck() { | ||
return doRemoteDataIntegrityCheck; | ||
} | ||
|
||
} |
Oops, something went wrong.