Package com.github.ambry.cloud.azure
Class CosmosChangeFeedFindToken
- java.lang.Object
-
- com.github.ambry.cloud.azure.CosmosChangeFeedFindToken
-
- All Implemented Interfaces:
com.github.ambry.replication.FindToken
public class CosmosChangeFeedFindToken extends java.lang.Object implements com.github.ambry.replication.FindToken
Class representing the replication token to track replication progress using Cosmos change feed.
-
-
Constructor Summary
Constructors Constructor Description CosmosChangeFeedFindToken()
Default constructor to create aCosmosChangeFeedFindToken
with uninitialized continuation token.CosmosChangeFeedFindToken(long bytesRead, java.lang.String startContinuationToken, java.lang.String endContinuationToken, int index, int totalItems, java.lang.String cacheSessionId)
CreateCosmosChangeFeedFindToken
from provided values.CosmosChangeFeedFindToken(long bytesRead, java.lang.String startContinuationToken, java.lang.String endContinuationToken, int index, int totalItems, java.lang.String cacheSessionId, short version)
Constructor to create aCosmosChangeFeedFindToken
with specified token values and specified version.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static CosmosChangeFeedFindToken
fromBytes(java.io.DataInputStream inputStream)
DeserializeCosmosChangeFeedFindToken
object from input stream.long
getBytesRead()
java.lang.String
getCacheSessionId()
Return cacheSessionId of the current token.java.lang.String
getEndContinuationToken()
int
getIndex()
Return index of the current token.java.lang.String
getStartContinuationToken()
Return startContinuationToken of the current token.int
getTotalItems()
Return totalitems in the current token.com.github.ambry.replication.FindTokenType
getType()
short
getVersion()
int
hashCode()
int
size()
Calculate size of the token.byte[]
toBytes()
SerializeCosmosChangeFeedFindToken
to byte array.java.lang.String
toString()
-
-
-
Constructor Detail
-
CosmosChangeFeedFindToken
public CosmosChangeFeedFindToken()
Default constructor to create aCosmosChangeFeedFindToken
with uninitialized continuation token.
-
CosmosChangeFeedFindToken
public CosmosChangeFeedFindToken(long bytesRead, java.lang.String startContinuationToken, java.lang.String endContinuationToken, int index, int totalItems, java.lang.String cacheSessionId)
CreateCosmosChangeFeedFindToken
from provided values.- Parameters:
bytesRead
- bytes read by remote so far.startContinuationToken
- start token from Cosmos.endContinuationToken
- end token from Cosmos.index
- index in cache upto which items are consumed by remote.totalItems
- total number of items in cache.cacheSessionId
- request id of the change feed query.
-
CosmosChangeFeedFindToken
public CosmosChangeFeedFindToken(long bytesRead, java.lang.String startContinuationToken, java.lang.String endContinuationToken, int index, int totalItems, java.lang.String cacheSessionId, short version)
Constructor to create aCosmosChangeFeedFindToken
with specified token values and specified version.- Parameters:
bytesRead
- bytes read by remote so far.startContinuationToken
- start token from Cosmos.endContinuationToken
- end token from Cosmos.index
- index in cache upto which items are consumed by remote.totalItems
- total number of items in cache.cacheSessionId
- request id of the change feed query.version
- token version.
-
-
Method Detail
-
fromBytes
public static CosmosChangeFeedFindToken fromBytes(java.io.DataInputStream inputStream) throws java.io.IOException
DeserializeCosmosChangeFeedFindToken
object from input stream.- Parameters:
inputStream
-DataOutputStream
to deserialize from.- Returns:
CosmosChangeFeedFindToken
object.- Throws:
java.io.IOException
-
toBytes
public byte[] toBytes()
SerializeCosmosChangeFeedFindToken
to byte array.- Specified by:
toBytes
in interfacecom.github.ambry.replication.FindToken
- Returns:
- serialized byte array.
-
size
public int size()
Calculate size of the token.- Returns:
- size of the token.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
getStartContinuationToken
public java.lang.String getStartContinuationToken()
Return startContinuationToken of the current token.- Returns:
- startContinuationToken.
-
getEndContinuationToken
public java.lang.String getEndContinuationToken()
-
getIndex
public int getIndex()
Return index of the current token.- Returns:
- index.
-
getTotalItems
public int getTotalItems()
Return totalitems in the current token.- Returns:
- totalitems.
-
getBytesRead
public long getBytesRead()
- Specified by:
getBytesRead
in interfacecom.github.ambry.replication.FindToken
-
getVersion
public short getVersion()
- Specified by:
getVersion
in interfacecom.github.ambry.replication.FindToken
-
getType
public com.github.ambry.replication.FindTokenType getType()
- Specified by:
getType
in interfacecom.github.ambry.replication.FindToken
-
getCacheSessionId
public java.lang.String getCacheSessionId()
Return cacheSessionId of the current token.- Returns:
- cacheSessionId.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-