org.openstreetmap.osmosis.core.apidb.v0_6.impl
Class ReplicationState

java.lang.Object
  extended by org.openstreetmap.osmosis.core.apidb.v0_6.impl.ReplicationState
All Implemented Interfaces:
Storeable

public class ReplicationState
extends java.lang.Object
implements Storeable

Contains the state to be remembered between replication invocations. This state ensures that no data is missed during replication, and none is repeated.


Constructor Summary
ReplicationState(long txnMax, long txnMaxQueried, java.util.List<java.lang.Long> txnActive, java.util.List<java.lang.Long> txnReady, java.util.Date timestamp, long sequenceNumber)
          Creates a new instance.
ReplicationState(java.util.Properties properties)
          Creates a new instance.
ReplicationState(StoreReader reader, StoreClassRegister scr)
          Creates a new instance.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 long getSequenceNumber()
          Gets the replication sequence number.
 java.util.Date getTimestamp()
          Gets the maximum timestamp of data currently read from the database.
 java.util.List<java.lang.Long> getTxnActive()
          Gets the currently active transaction ids.
 long getTxnMax()
          Gets the maximum transaction id in the database.
 long getTxnMaxQueried()
          Gets the maximum transaction id currently replicated from the database.
 java.util.List<java.lang.Long> getTxnReady()
          Gets the previously active transaction ids that can now be queried.
 int hashCode()
          
 void setSequenceNumber(long sequenceNumber)
          Sets the replication sequence number.
 void setTimestamp(java.util.Date timestamp)
          Sets the maximum timestamp of data currently read from the database.
 void setTxnMax(long txnMax)
          Sets the maximum transaction id in the database.
 void setTxnMaxQueried(long txnMaxQueried)
          Sets the maximum transaction id currently replicated from the database.
 void store(java.util.Properties properties)
          Writes all state into the provided properties object.
 void store(StoreWriter writer, StoreClassRegister storeClassRegister)
          Stores all state to the specified store writer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationState

public ReplicationState(long txnMax,
                        long txnMaxQueried,
                        java.util.List<java.lang.Long> txnActive,
                        java.util.List<java.lang.Long> txnReady,
                        java.util.Date timestamp,
                        long sequenceNumber)
Creates a new instance.

Parameters:
txnMax - The maximum transaction id in the database.
txnMaxQueried - The maximum transaction id currently replicated from the database.
txnActive - The currently active transaction ids.
txnReady - The previously active transaction ids that can now be queried.
timestamp - The maximum timestamp of data currently read from the database.
sequenceNumber - The replication sequence number.

ReplicationState

public ReplicationState(StoreReader reader,
                        StoreClassRegister scr)
Creates a new instance.

Parameters:
reader - The store to read state from.
scr - Maintains the mapping between classes and their identifiers within the store.

ReplicationState

public ReplicationState(java.util.Properties properties)
Creates a new instance.

Parameters:
properties - The properties to load state from.
Method Detail

store

public void store(StoreWriter writer,
                  StoreClassRegister storeClassRegister)
Stores all state to the specified store writer.

Specified by:
store in interface Storeable
Parameters:
writer - The writer that persists data to an underlying store.
storeClassRegister - Maintains the mapping between classes and their identifiers within the store.

store

public void store(java.util.Properties properties)
Writes all state into the provided properties object.

Parameters:
properties - The properties to be updated.

getTxnMax

public long getTxnMax()
Gets the maximum transaction id in the database.

Returns:
The transaction id.

setTxnMax

public void setTxnMax(long txnMax)
Sets the maximum transaction id in the database.

Parameters:
txnMax - The transaction id.

getTxnMaxQueried

public long getTxnMaxQueried()
Gets the maximum transaction id currently replicated from the database.

Returns:
The transaction id.

setTxnMaxQueried

public void setTxnMaxQueried(long txnMaxQueried)
Sets the maximum transaction id currently replicated from the database.

Parameters:
txnMaxQueried - The transaction id.

getTxnActive

public java.util.List<java.lang.Long> getTxnActive()
Gets the currently active transaction ids. These cannot be replicated until they have committed.

Returns:
The list of transaction ids.

getTxnReady

public java.util.List<java.lang.Long> getTxnReady()
Gets the previously active transaction ids that can now be queried.

Returns:
The list of transaction ids.

getTimestamp

public java.util.Date getTimestamp()
Gets the maximum timestamp of data currently read from the database.

Returns:
The timestamp.

setTimestamp

public void setTimestamp(java.util.Date timestamp)
Sets the maximum timestamp of data currently read from the database.

Parameters:
timestamp - The timestamp.

getSequenceNumber

public long getSequenceNumber()
Gets the replication sequence number.

Returns:
The sequence number.

setSequenceNumber

public void setSequenceNumber(long sequenceNumber)
Sets the replication sequence number.

Parameters:
sequenceNumber - The sequence number.

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object