Class 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 Detail

      • CosmosChangeFeedFindToken

        public CosmosChangeFeedFindToken()
        Default constructor to create a CosmosChangeFeedFindToken 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)
        Create CosmosChangeFeedFindToken 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 a CosmosChangeFeedFindToken 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

      • toBytes

        public byte[] toBytes()
        Serialize CosmosChangeFeedFindToken to byte array.
        Specified by:
        toBytes in interface com.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 class java.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 interface com.github.ambry.replication.FindToken
      • getVersion

        public short getVersion()
        Specified by:
        getVersion in interface com.github.ambry.replication.FindToken
      • getType

        public com.github.ambry.replication.FindTokenType getType()
        Specified by:
        getType in interface com.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 class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object