Skip to content

Commit

Permalink
Java docs
Browse files Browse the repository at this point in the history
Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
  • Loading branch information
Bukhtawar committed Sep 12, 2022
1 parent df71151 commit 593c8d1
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,24 @@
*/
public interface TransferService {

/**
* Uploads the {@link TransferFileSnapshot} async, once the upload is complete the callback is invoked
* @param fileSnapshot the file snapshot to upload
* @param remotePath the remote path where upload should be made
* @param listener the callback to be invoked once upload completes successfully/fails
*/
void uploadBlobAsync(
final TransferFileSnapshot fileSnapshot,
Iterable<String> remotePath,
ActionListener<TransferFileSnapshot> listener
);

/**
* Uploads the {@link TransferFileSnapshot} blob
* @param fileSnapshot the file snapshot to upload
* @param remotePath the remote path where upload should be made
* @throws IOException
*/
void uploadBlob(final TransferFileSnapshot fileSnapshot, Iterable<String> remotePath) throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,34 @@
package org.opensearch.index.translog.transfer;

import org.opensearch.index.translog.transfer.FileSnapshot.TransferFileSnapshot;
import org.opensearch.index.translog.transfer.FileSnapshot.CheckpointFileSnapshot;
import org.opensearch.index.translog.transfer.FileSnapshot.TranslogFileSnapshot;

import java.util.Set;

/**
* The snapshot of the files and it's metadata that is transferred to the {@link TransferService}
* The snapshot of the generational translog and checkpoint files and it's corresponding metadata that is transferred
* to the {@link TransferService}
*
* @opensearch.internal
*/
public interface TransferSnapshot {

/**
* The snapshot of the checkpoint generational files
* @return the set of {@link CheckpointFileSnapshot}
*/
Set<TransferFileSnapshot> getCheckpointFileSnapshots();

/**
* The snapshot of the translog generational files
* @return the set of {@link TranslogFileSnapshot}
*/
Set<TransferFileSnapshot> getTranslogFileSnapshots();

/**
* The translog transfer metadata of this {@link TransferSnapshot}
* @return the translog transfer metadata
*/
TranslogTransferMetadata getTranslogTransferMetadata();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import java.util.Objects;

/**
* The metadata associated with every transfer {@link TransferSnapshot}
* The metadata associated with every transfer {@link TransferSnapshot}. The metadata is uploaded at the end of the
* tranlog and generational checkpoint uploads to mark the latest generation and the translog/checkpoint files that are
* still referenced by the last checkpoint.
*
* @opensearch.internal
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
*/
public interface FileTransferListener {

/**
* Invoked when the transfer of a single {@link TransferFileSnapshot} succeeds
* @param fileSnapshot the corresponding file snapshot
*/
void onSuccess(TransferFileSnapshot fileSnapshot);

/**
* Invoked when the transfer of a single {@link TransferFileSnapshot} fails
* @param fileSnapshot the corresponding file snapshot
* @param e the exception while processing the {@link TransferFileSnapshot}
*/
void onFailure(TransferFileSnapshot fileSnapshot, Exception e);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@
*/
public interface TranslogTransferListener {

/**
* Invoked when the transfer of {@link TransferSnapshot} succeeds
* @param transferSnapshot the transfer snapshot
* @throws IOException
*/
void onUploadComplete(TransferSnapshot transferSnapshot) throws IOException;

/**
* Invoked when the transfer of {@link TransferSnapshot} fails
* @param transferSnapshot the transfer snapshot
* @param ex the exception while processing the {@link TransferSnapshot}
* @throws IOException
*/
void onUploadFailed(TransferSnapshot transferSnapshot, Exception ex) throws IOException;
}

0 comments on commit 593c8d1

Please sign in to comment.