Class GridCacheVersion
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.version.GridCacheVersion
-
- All Implemented Interfaces:
Externalizable,Serializable,Comparable<CacheEntryVersion>,CacheEntryVersion,Message
- Direct Known Subclasses:
GridCacheVersionEx
public class GridCacheVersion extends Object implements Message, Externalizable, CacheEntryVersion
Grid unique version.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.apache.ignite.plugin.extensions.communication.Message
DIRECT_TYPE_SIZE
-
-
Constructor Summary
Constructors Constructor Description GridCacheVersion()Empty constructor required byExternalizable.GridCacheVersion(int topVer, int nodeOrderDrId, long order)GridCacheVersion(int topVer, long order, int nodeOrder, int dataCenterId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IgniteUuidasIgniteUuid()byteclusterId()Cluster id is a value to distinguish updates in case user wants to aggregate and sort updates from several Ignite clusters.intcompareTo(CacheEntryVersion other)GridCacheVersionconflictVersion()bytedataCenterId()shortdirectType()Gets message type.booleanequals(Object o)bytefieldsCount()Gets fields count.inthashCode()booleanisGreater(GridCacheVersion ver)booleanisGreaterEqual(GridCacheVersion ver)booleanisLess(GridCacheVersion ver)booleanisLessEqual(GridCacheVersion ver)intnodeOrder()intnodeOrderAndDrIdRaw()Gets combined node order and DR ID.voidonAckReceived()Method called when ack message received.longorder()Order of the update.CacheEntryVersionotherClusterVersion()If source of the update is "local" cluster thennullwill be returned.voidreadExternal(ObjectInput in)booleanreadFrom(ByteBuffer buf, MessageReader reader)Reads this message from provided byte buffer.inttopologyVersion()StringtoString()voidwriteExternal(ObjectOutput out)booleanwriteTo(ByteBuffer buf, MessageWriter writer)Writes this message to provided byte buffer.
-
-
-
Constructor Detail
-
GridCacheVersion
public GridCacheVersion()
Empty constructor required byExternalizable.
-
GridCacheVersion
public GridCacheVersion(int topVer, long order, int nodeOrder, int dataCenterId)- Parameters:
topVer- Topology version plus number of seconds from the start time of the first grid node.order- Version order.nodeOrder- Node order.dataCenterId- Replication data center ID.
-
GridCacheVersion
public GridCacheVersion(int topVer, int nodeOrderDrId, long order)- Parameters:
topVer- Topology version plus number of seconds from the start time of the first grid node.nodeOrderDrId- Node order and DR ID.order- Version order.
-
-
Method Detail
-
topologyVersion
public int topologyVersion()
- Specified by:
topologyVersionin interfaceCacheEntryVersion- Returns:
- Topology version plus number of seconds from the start time of the first grid node.
-
nodeOrderAndDrIdRaw
public int nodeOrderAndDrIdRaw()
Gets combined node order and DR ID.- Returns:
- Combined integer for node order and DR ID.
-
order
public long order()
Description copied from interface:CacheEntryVersionOrder of the update. Value is an incremental counter value. Scope of counter is node.- Specified by:
orderin interfaceCacheEntryVersion- Returns:
- Version order.
-
otherClusterVersion
public CacheEntryVersion otherClusterVersion()
If source of the update is "local" cluster thennullwill be returned. If updated comes from the other cluster usingIgniteInternalCache.putAllConflict(Map)then entry version for other cluster.- Specified by:
otherClusterVersionin interfaceCacheEntryVersion- Returns:
- Replication version.
- See Also:
IgniteInternalCache.putAllConflict(Map),IgniteInternalCache.removeAllConflict(Map)
-
nodeOrder
public int nodeOrder()
- Specified by:
nodeOrderin interfaceCacheEntryVersion- Returns:
- Node order on which this version was assigned.
-
clusterId
public byte clusterId()
Cluster id is a value to distinguish updates in case user wants to aggregate and sort updates from several Ignite clusters.clusterIdid can be set for the node usingGridCacheVersionManager.dataCenterId(byte).- Specified by:
clusterIdin interfaceCacheEntryVersion- Returns:
- Cluster id.
-
dataCenterId
public byte dataCenterId()
- Returns:
- DR mask.
-
conflictVersion
public GridCacheVersion conflictVersion()
- Returns:
- Conflict version.
-
isGreater
public boolean isGreater(GridCacheVersion ver)
- Parameters:
ver- Version.- Returns:
Trueif this version is greater.
-
isGreaterEqual
public boolean isGreaterEqual(GridCacheVersion ver)
- Parameters:
ver- Version.- Returns:
Trueif this version is greater or equal.
-
isLess
public boolean isLess(GridCacheVersion ver)
- Parameters:
ver- Version.- Returns:
Trueif this version is less.
-
isLessEqual
public boolean isLessEqual(GridCacheVersion ver)
- Parameters:
ver- Version.- Returns:
Trueif this version is less or equal.
-
asIgniteUuid
public IgniteUuid asIgniteUuid()
- Returns:
- Version represented as
IgniteUuid
-
onAckReceived
public void onAckReceived()
Method called when ack message received.- Specified by:
onAckReceivedin interfaceMessage
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
compareTo
public int compareTo(CacheEntryVersion other)
- Specified by:
compareToin interfaceComparable<CacheEntryVersion>
-
writeTo
public boolean writeTo(ByteBuffer buf, MessageWriter writer)
Writes this message to provided byte buffer.
-
readFrom
public boolean readFrom(ByteBuffer buf, MessageReader reader)
Reads this message from provided byte buffer.
-
directType
public short directType()
Gets message type.- Specified by:
directTypein interfaceMessage- Returns:
- Message type.
-
fieldsCount
public byte fieldsCount()
Gets fields count.- Specified by:
fieldsCountin interfaceMessage- Returns:
- Fields count.
-
-