Package com.github.ambry.cloud.azure
Class CosmosChangeFeedBasedReplicationFeed
- java.lang.Object
-
- com.github.ambry.cloud.azure.CosmosChangeFeedBasedReplicationFeed
-
- All Implemented Interfaces:
AzureReplicationFeed
,java.io.Closeable
,java.lang.AutoCloseable
public final class CosmosChangeFeedBasedReplicationFeed extends java.lang.Object implements AzureReplicationFeed
The replication feed that provides next list of blobs to replicate from Azure and correspondingFindToken
using Cosmos change feed apis.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.ambry.cloud.azure.AzureReplicationFeed
AzureReplicationFeed.FeedType
-
-
Constructor Summary
Constructors Constructor Description CosmosChangeFeedBasedReplicationFeed(CosmosDataAccessor cosmosDataAccessor, AzureMetrics azureMetrics, int changeFeedBatchSize)
Constructor to create aCosmosChangeFeedBasedReplicationFeed
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
FindResult
getNextEntriesAndUpdatedToken(com.github.ambry.replication.FindToken curFindToken, long maxTotalSizeOfEntries, java.lang.String partitionPath)
Get next set of change feed entries for the specified partition, after thecurFindToken
.
-
-
-
Constructor Detail
-
CosmosChangeFeedBasedReplicationFeed
public CosmosChangeFeedBasedReplicationFeed(CosmosDataAccessor cosmosDataAccessor, AzureMetrics azureMetrics, int changeFeedBatchSize)
Constructor to create aCosmosChangeFeedBasedReplicationFeed
object.- Parameters:
cosmosDataAccessor
-CosmosDataAccessor
object.azureMetrics
- {@link {@link AzureMetrics} object.changeFeedBatchSize
- batch size for each change feed request.
-
-
Method Detail
-
getNextEntriesAndUpdatedToken
public FindResult getNextEntriesAndUpdatedToken(com.github.ambry.replication.FindToken curFindToken, long maxTotalSizeOfEntries, java.lang.String partitionPath) throws com.microsoft.azure.cosmosdb.DocumentClientException
Get next set of change feed entries for the specified partition, after thecurFindToken
. The number of entries is capped by maxEntriesSize. This method creates a cache for change feed entries. If thecurFindToken
is not valid, or if all the items in the cache are consumed, then it queries Cosmos for new entries.- Specified by:
getNextEntriesAndUpdatedToken
in interfaceAzureReplicationFeed
- Parameters:
curFindToken
-FindToken
after which the next entries have to be returned.maxTotalSizeOfEntries
- maximum size of all the blobs returned.partitionPath
- Partition for which change feed entries have to be returned.- Returns:
FindResult
instance that contains updatedFindToken
object which can act as a bookmark for subsequent requests, andList
ofCloudBlobMetadata
entries.- Throws:
com.microsoft.azure.cosmosdb.DocumentClientException
- if any cosmos query encounters error.
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-