Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sandeep Kumawat <[email protected]>
  • Loading branch information
Sandeep Kumawat committed Apr 4, 2024
1 parent 477fada commit 929482e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.common.blobstore;

import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.core.action.ActionListener;

import java.io.IOException;
Expand Down Expand Up @@ -86,8 +87,9 @@ public interface BlobContainer {
* @throws NoSuchFileException if the blob does not exist
* @throws IOException if the blob can not be read.
*/
@ExperimentalApi
default BlobDownloadResponse readBlobWithMetadata(String blobName) throws IOException {
return null;
throw new UnsupportedOperationException("readBlobWithMetadata is not implemented yet");
};

/**
Expand Down Expand Up @@ -160,13 +162,16 @@ default long readBlobPreferredLength() {
* @throws FileAlreadyExistsException if failIfAlreadyExists is true and a blob by the same name already exists
* @throws IOException if the input stream could not be read, or the target blob could not be written to.
*/
@ExperimentalApi
default void writeBlobWithMetadata(
String blobName,
InputStream inputStream,
Map<String, String> metadata,
long blobSize,
boolean failIfAlreadyExists
) throws IOException {};
) throws IOException {
throw new UnsupportedOperationException("writeBlobWithMetadata is not implemented yet");
};

/**
* Reads blob content from the input stream and writes it to the container in a new blob with the given name,
Expand Down Expand Up @@ -210,13 +215,16 @@ default void writeBlobWithMetadata(
* @throws FileAlreadyExistsException if failIfAlreadyExists is true and a blob by the same name already exists
* @throws IOException if the input stream could not be read, or the target blob could not be written to.
*/
@ExperimentalApi
default void writeBlobAtomicWithMetadata(
String blobName,
InputStream inputStream,
Map<String, String> metadata,
long blobSize,
boolean failIfAlreadyExists
) throws IOException {};
) throws IOException {
throw new UnsupportedOperationException("writeBlobAtomicWithMetadata is not implemented yet");
};

/**
* Deletes this container and all its contents from the repository.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import java.util.Map;

/**
* A class for blob download response
* Represents the response from a blob download operation, containing both the
* input stream of the blob content and the associated metadata.
*
* @opensearch.internal
*/
Expand All @@ -21,12 +22,12 @@ public class BlobDownloadResponse {
/**
* Downloaded blob InputStream
*/
private InputStream inputStream;
private final InputStream inputStream;

/**
* Metadata of the downloaded blob
*/
private Map<String, String> metadata;
private final Map<String, String> metadata;

public InputStream getInputStream() {
return inputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.index.translog.transfer;

import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.common.blobstore.BlobDownloadResponse;
import org.opensearch.common.blobstore.BlobMetadata;
import org.opensearch.common.blobstore.BlobPath;
Expand Down Expand Up @@ -133,6 +134,7 @@ void uploadBlobs(
* @return {@link BlobDownloadResponse} of the remote file
* @throws IOException the exception while reading the data
*/
@ExperimentalApi
BlobDownloadResponse downloadBlobWithMetadata(Iterable<String> path, String fileName) throws IOException;

void listAllInSortedOrder(Iterable<String> path, String filenamePrefix, int limit, ActionListener<List<BlobMetadata>> listener);
Expand Down

0 comments on commit 929482e

Please sign in to comment.