com.continuent.tungsten.replicator.database
Class MySQLEventId

java.lang.Object
  extended by com.continuent.tungsten.replicator.database.MySQLEventId
All Implemented Interfaces:
EventId, java.lang.Comparable<EventId>

public class MySQLEventId
extends java.lang.Object
implements EventId

Implements a MySQL event ID, which have the following form:

[prefix-name.]file_index:offset[;session_id]
For example, a MySQL event ID formatted by Tungsten would typically appear as follows:
mysql-bin.014371:0000000064207416;0
This class will correctly match and sort that event ID against events having the following formats:
mysql-bin.014371:64207416
014371:64207416


Constructor Summary
MySQLEventId(java.lang.String rawEventId)
           
 
Method Summary
 int compareTo(EventId eventId)
          Compares two event IDs using the file index and offset as determinants for collation.
 int compareTo(MySQLEventId eventId)
          Compares two event IDs using the file index and offset as determinants for collation.
 java.lang.String getDbmsType()
          Return the event ID DBMS type.
 long getFileIndex()
           
 java.lang.String getFileName()
           
 long getOffset()
           
 java.lang.String getRawEventId()
           
 long getSessionId()
           
 boolean isValid()
          Returns true if this is a syntactically valid event ID.
 java.lang.String toString()
          Prints event ID in standard format for MySQL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MySQLEventId

public MySQLEventId(java.lang.String rawEventId)
Method Detail

getRawEventId

public java.lang.String getRawEventId()

getFileName

public java.lang.String getFileName()

getFileIndex

public long getFileIndex()

getOffset

public long getOffset()

getSessionId

public long getSessionId()

isValid

public boolean isValid()
Returns true if this is a syntactically valid event ID.

Specified by:
isValid in interface EventId
See Also:
EventId.isValid()

getDbmsType

public java.lang.String getDbmsType()
Return the event ID DBMS type.

Specified by:
getDbmsType in interface EventId
See Also:
EventId.getDbmsType()

compareTo

public int compareTo(EventId eventId)
Compares two event IDs using the file index and offset as determinants for collation.

Specified by:
compareTo in interface EventId
Specified by:
compareTo in interface java.lang.Comparable<EventId>
See Also:
Comparable.compareTo(java.lang.Object)

compareTo

public int compareTo(MySQLEventId eventId)
Compares two event IDs using the file index and offset as determinants for collation.


toString

public java.lang.String toString()
Prints event ID in standard format for MySQL. If invalid, return the raw event ID.

Specified by:
toString in interface EventId
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()