Class CoordinatedCloudStorageDataTransferApi
- java.lang.Object
-
- org.apache.cassandra.spark.bulkwriter.cloudstorage.coordinated.CoordinatedCloudStorageDataTransferApi
-
- All Implemented Interfaces:
CloudStorageDataTransferApi,CoordinatedCloudStorageDataTransferApiExtension,MultiClusterSupport<CloudStorageDataTransferApiImpl>
public class CoordinatedCloudStorageDataTransferApi extends java.lang.Object implements CloudStorageDataTransferApi, CoordinatedCloudStorageDataTransferApiExtension, MultiClusterSupport<CloudStorageDataTransferApiImpl>
-
-
Constructor Summary
Constructors Constructor Description CoordinatedCloudStorageDataTransferApi(com.google.common.util.concurrent.RateLimiter sidecarApiCallRateLimiter, java.util.Map<java.lang.String,CloudStorageDataTransferApiImpl> dataTransferApiByCluster)CoordinatedCloudStorageDataTransferApi(java.util.Map<java.lang.String,CloudStorageDataTransferApiImpl> dataTransferApiByCluster)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortRestoreJob()voidcreateRestoreJob(o.a.c.sidecar.client.shaded.common.request.data.CreateRestoreJobRequestPayload createRestoreJobRequestPayload)java.util.concurrent.CompletableFuture<java.lang.Void>createRestoreSliceFromDriver(o.a.c.sidecar.client.shaded.client.SidecarInstance sidecarInstance, o.a.c.sidecar.client.shaded.common.request.data.CreateSliceRequestPayload createSliceRequestPayload)Called from driver level to create a restore slice asynchronously.voidcreateRestoreSliceFromExecutor(java.lang.String clusterId, o.a.c.sidecar.client.shaded.common.request.data.CreateSliceRequestPayload createSliceRequestPayload)Called from task level to create a restore slice.voidcreateRestoreSliceFromExecutor(o.a.c.sidecar.client.shaded.client.SidecarInstance sidecarInstance, o.a.c.sidecar.client.shaded.common.request.data.CreateSliceRequestPayload createSliceRequestPayload)Called from task level to create a restore slice.voidforEach(java.util.function.BiConsumer<java.lang.String,CloudStorageDataTransferApiImpl> action)Iterate through all valuesCloudStorageDataTransferApiImplgetValueOrNull(java.lang.String clusterId)Look up a value based on clusterIdvoidrestoreJobProgress(o.a.c.sidecar.client.shaded.common.data.RestoreJobProgressFetchPolicy fetchPolicy, java.util.function.Predicate<java.lang.String> shouldSkipCluster, java.util.function.BiConsumer<java.lang.String,o.a.c.sidecar.client.shaded.common.response.data.RestoreJobProgressResponsePayload> progressHandler)Retrieve the restore job progress with the specified fetch policy and handle the progress responseo.a.c.sidecar.client.shaded.common.response.data.RestoreJobSummaryResponsePayloadrestoreJobSummary()intsize()voidupdateRestoreJob(o.a.c.sidecar.client.shaded.common.request.data.UpdateRestoreJobRequestPayload updateRestoreJobRequestPayload)BundleStorageObjectuploadBundle(StorageCredentials writeCredentials, Bundle bundle)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.spark.bulkwriter.cloudstorage.CloudStorageDataTransferApi
handleInterruption
-
Methods inherited from interface org.apache.cassandra.spark.bulkwriter.cloudstorage.coordinated.MultiClusterSupport
getValueOrThrow
-
-
-
-
Constructor Detail
-
CoordinatedCloudStorageDataTransferApi
public CoordinatedCloudStorageDataTransferApi(@NotNull java.util.Map<java.lang.String,CloudStorageDataTransferApiImpl> dataTransferApiByCluster)
-
CoordinatedCloudStorageDataTransferApi
public CoordinatedCloudStorageDataTransferApi(com.google.common.util.concurrent.RateLimiter sidecarApiCallRateLimiter, @NotNull java.util.Map<java.lang.String,CloudStorageDataTransferApiImpl> dataTransferApiByCluster)
-
-
Method Detail
-
size
public int size()
- Specified by:
sizein interfaceMultiClusterSupport<CloudStorageDataTransferApiImpl>- Returns:
- the total number of clusters
-
forEach
public void forEach(java.util.function.BiConsumer<java.lang.String,CloudStorageDataTransferApiImpl> action)
Description copied from interface:MultiClusterSupportIterate through all values- Specified by:
forEachin interfaceMultiClusterSupport<CloudStorageDataTransferApiImpl>- Parameters:
action- function to consume the values
-
uploadBundle
public BundleStorageObject uploadBundle(StorageCredentials writeCredentials, Bundle bundle) throws org.apache.cassandra.spark.exception.S3ApiCallException
- Specified by:
uploadBundlein interfaceCloudStorageDataTransferApi- Throws:
org.apache.cassandra.spark.exception.S3ApiCallException
-
restoreJobSummary
public o.a.c.sidecar.client.shaded.common.response.data.RestoreJobSummaryResponsePayload restoreJobSummary() throws org.apache.cassandra.spark.exception.SidecarApiCallException- Specified by:
restoreJobSummaryin interfaceCloudStorageDataTransferApi- Throws:
org.apache.cassandra.spark.exception.SidecarApiCallException
-
updateRestoreJob
public void updateRestoreJob(o.a.c.sidecar.client.shaded.common.request.data.UpdateRestoreJobRequestPayload updateRestoreJobRequestPayload) throws org.apache.cassandra.spark.exception.SidecarApiCallException- Specified by:
updateRestoreJobin interfaceCloudStorageDataTransferApi- Throws:
org.apache.cassandra.spark.exception.SidecarApiCallException
-
abortRestoreJob
public void abortRestoreJob() throws org.apache.cassandra.spark.exception.SidecarApiCallException- Specified by:
abortRestoreJobin interfaceCloudStorageDataTransferApi- Throws:
org.apache.cassandra.spark.exception.SidecarApiCallException
-
createRestoreSliceFromExecutor
public void createRestoreSliceFromExecutor(java.lang.String clusterId, o.a.c.sidecar.client.shaded.common.request.data.CreateSliceRequestPayload createSliceRequestPayload) throws org.apache.cassandra.spark.exception.SidecarApiCallExceptionDescription copied from interface:CoordinatedCloudStorageDataTransferApiExtensionCalled from task level to create a restore slice. The request retries until the slice is created (201) or retry has exhausted.- Specified by:
createRestoreSliceFromExecutorin interfaceCoordinatedCloudStorageDataTransferApiExtension- Parameters:
clusterId- identifier of the cluster to create slicecreateSliceRequestPayload- the payload to create the slice- Throws:
org.apache.cassandra.spark.exception.SidecarApiCallException- when an error occurs during the slice creation
-
restoreJobProgress
public void restoreJobProgress(o.a.c.sidecar.client.shaded.common.data.RestoreJobProgressFetchPolicy fetchPolicy, java.util.function.Predicate<java.lang.String> shouldSkipCluster, java.util.function.BiConsumer<java.lang.String,o.a.c.sidecar.client.shaded.common.response.data.RestoreJobProgressResponsePayload> progressHandler) throws org.apache.cassandra.spark.exception.SidecarApiCallExceptionDescription copied from interface:CoordinatedCloudStorageDataTransferApiExtensionRetrieve the restore job progress with the specified fetch policy and handle the progress responseThe API is invoked by Spark driver.
- Specified by:
restoreJobProgressin interfaceCoordinatedCloudStorageDataTransferApiExtension- Parameters:
fetchPolicy- determines how detailed is the fetched restore job progressshouldSkipCluster- filter to determine whether a cluster should be skippedprogressHandler- handles restore job progress- Throws:
org.apache.cassandra.spark.exception.SidecarApiCallException- exception from calling sidecar API
-
getValueOrNull
@Nullable public CloudStorageDataTransferApiImpl getValueOrNull(@NotNull java.lang.String clusterId)
Description copied from interface:MultiClusterSupportLook up a value based on clusterId- Specified by:
getValueOrNullin interfaceMultiClusterSupport<CloudStorageDataTransferApiImpl>- Parameters:
clusterId- cluster id- Returns:
- the value of type T associated with the clusterId, or null if not found
-
createRestoreJob
public void createRestoreJob(o.a.c.sidecar.client.shaded.common.request.data.CreateRestoreJobRequestPayload createRestoreJobRequestPayload) throws org.apache.cassandra.spark.exception.SidecarApiCallException- Specified by:
createRestoreJobin interfaceCloudStorageDataTransferApi- Throws:
org.apache.cassandra.spark.exception.SidecarApiCallException
-
createRestoreSliceFromExecutor
public void createRestoreSliceFromExecutor(o.a.c.sidecar.client.shaded.client.SidecarInstance sidecarInstance, o.a.c.sidecar.client.shaded.common.request.data.CreateSliceRequestPayload createSliceRequestPayload) throws org.apache.cassandra.spark.exception.SidecarApiCallExceptionDescription copied from interface:CloudStorageDataTransferApiCalled from task level to create a restore slice. The request retries until the slice is created (201) or retry has exhausted.- Specified by:
createRestoreSliceFromExecutorin interfaceCloudStorageDataTransferApi- Parameters:
sidecarInstance- the sidecar instance where we will create the slicecreateSliceRequestPayload- the payload to create the slice- Throws:
org.apache.cassandra.spark.exception.SidecarApiCallException- when an error occurs during the slice creation
-
createRestoreSliceFromDriver
public java.util.concurrent.CompletableFuture<java.lang.Void> createRestoreSliceFromDriver(o.a.c.sidecar.client.shaded.client.SidecarInstance sidecarInstance, o.a.c.sidecar.client.shaded.common.request.data.CreateSliceRequestPayload createSliceRequestPayload)Description copied from interface:CloudStorageDataTransferApiCalled from driver level to create a restore slice asynchronously. The request retries until the slice succeeds (200), failed (550) or retry has exhausted.- Specified by:
createRestoreSliceFromDriverin interfaceCloudStorageDataTransferApi- Parameters:
sidecarInstance- the sidecar instance where we will create the slicecreateSliceRequestPayload- the payload to create the slice- Returns:
- future of create restore slice request
-
-