com.continuent.tungsten.replicator.thl
Class Protocol

java.lang.Object
  extended by com.continuent.tungsten.replicator.thl.Protocol

public class Protocol
extends java.lang.Object

This class defines a Protocol

Version:
1.0
Author:
Teemu Ollakka

Field Summary
protected  java.lang.String clientSourceId
           
static java.lang.String MAX_SEQNO
           
static java.lang.String MIN_SEQNO
           
protected  java.io.ObjectInputStream ois
           
protected  java.io.ObjectOutputStream oos
           
protected  PluginContext pluginContext
           
protected  int resetPeriod
           
static java.lang.String ROLE
           
protected  TungstenProperties serverCapabilities
           
protected  SocketWrapper socket
           
static java.lang.String SOURCE_ID
           
static java.lang.String VERSION
           
 
Constructor Summary
Protocol()
          Creates a new Protocol object
Protocol(PluginContext context, SocketWrapper socket)
          Creates a new Protocol object
Protocol(PluginContext context, SocketWrapper socket, int resetPeriod)
           
 
Method Summary
 SeqNoRange clientHandshake(long lastEpochNumber, long lastSeqno, int heartbeatMillis, java.lang.String lastEventId)
          Define a client handshake event including attendant information.
 long getClientLastEpochNumber()
          Returns the epoch number of last event received by client.
 long getClientLastSeqno()
          Returns the log sequence number of last event received by client.
 java.lang.String getClientSourceId()
          Returns the client source ID, which is set by a client protocol response to a server.
 TungstenProperties getServerCapabities()
          Returns server capabilities downloaded to client.
protected  ProtocolMessage readMessage()
          TODO: readMessage definition.
 ReplEvent requestReplEvent(long seqNo)
          TODO: requestReplicationDBMSEvent definition.
 void sendError(java.lang.String message)
          Send an error message back to client.
 void sendHeartbeat()
          Send a heartbeat message to client.
 void sendReplEvent(ReplEvent event, boolean forceSend)
          TODO: sendReplicationDBMSEvent definition.
 void serverHandshake(ProtocolHandshakeResponseValidator validator, long minSeqNo, long maxSeqNo)
          TODO: serverHandshake definition.
 ProtocolReplEventRequest waitReplEventRequest()
          TODO: waitReplicationDBMSEventRequest definition.
protected  void writeMessage(ProtocolMessage msg)
          TODO: writeMessage definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_ID

public static java.lang.String SOURCE_ID

ROLE

public static java.lang.String ROLE

VERSION

public static java.lang.String VERSION

MIN_SEQNO

public static java.lang.String MIN_SEQNO

MAX_SEQNO

public static java.lang.String MAX_SEQNO

pluginContext

protected PluginContext pluginContext

socket

protected SocketWrapper socket

serverCapabilities

protected TungstenProperties serverCapabilities

resetPeriod

protected int resetPeriod

ois

protected java.io.ObjectInputStream ois

oos

protected java.io.ObjectOutputStream oos

clientSourceId

protected java.lang.String clientSourceId
Constructor Detail

Protocol

public Protocol()
Creates a new Protocol object


Protocol

public Protocol(PluginContext context,
                SocketWrapper socket)
         throws java.io.IOException
Creates a new Protocol object

Throws:
java.io.IOException

Protocol

public Protocol(PluginContext context,
                SocketWrapper socket,
                int resetPeriod)
         throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getClientSourceId

public java.lang.String getClientSourceId()
Returns the client source ID, which is set by a client protocol response to a server.


getClientLastEpochNumber

public long getClientLastEpochNumber()
Returns the epoch number of last event received by client.


getClientLastSeqno

public long getClientLastSeqno()
Returns the log sequence number of last event received by client.


getServerCapabities

public TungstenProperties getServerCapabities()
Returns server capabilities downloaded to client.


readMessage

protected ProtocolMessage readMessage()
                               throws java.io.IOException,
                                      ReplicatorException
TODO: readMessage definition.

Throws:
java.io.IOException
ReplicatorException

writeMessage

protected void writeMessage(ProtocolMessage msg)
                     throws java.io.IOException
TODO: writeMessage definition.

Parameters:
msg -
Throws:
java.io.IOException
RemoteProtocolException

serverHandshake

public void serverHandshake(ProtocolHandshakeResponseValidator validator,
                            long minSeqNo,
                            long maxSeqNo)
                     throws ReplicatorException,
                            java.io.IOException,
                            java.lang.InterruptedException
TODO: serverHandshake definition.

Parameters:
minSeqNo -
maxSeqNo -
Throws:
ReplicatorException
java.io.IOException
java.lang.InterruptedException

clientHandshake

public SeqNoRange clientHandshake(long lastEpochNumber,
                                  long lastSeqno,
                                  int heartbeatMillis,
                                  java.lang.String lastEventId)
                           throws ReplicatorException,
                                  java.io.IOException
Define a client handshake event including attendant information.

Parameters:
lastEpochNumber - Epoch number client has from last sequence number
lastSeqno - Last sequence number client received
heartbeatMillis - Number of milliseconds between heartbeat events
Returns:
A sequence number range
Throws:
ReplicatorException
java.io.IOException

requestReplEvent

public ReplEvent requestReplEvent(long seqNo)
                           throws ReplicatorException,
                                  java.io.IOException
TODO: requestReplicationDBMSEvent definition.

Parameters:
seqNo -
Returns:
sql event
Throws:
ReplicatorException
java.io.IOException

waitReplEventRequest

public ProtocolReplEventRequest waitReplEventRequest()
                                              throws ReplicatorException,
                                                     java.io.IOException
TODO: waitReplicationDBMSEventRequest definition.

Returns:
protocol event request
Throws:
ReplicatorException
java.io.IOException

sendReplEvent

public void sendReplEvent(ReplEvent event,
                          boolean forceSend)
                   throws java.io.IOException
TODO: sendReplicationDBMSEvent definition.

Parameters:
event -
forceSend - TODO
Throws:
java.io.IOException

sendError

public void sendError(java.lang.String message)
               throws java.io.IOException
Send an error message back to client.

Throws:
java.io.IOException

sendHeartbeat

public void sendHeartbeat()
                   throws java.io.IOException
Send a heartbeat message to client.

Throws:
java.io.IOException