org.apache.zookeeper.server.persistence
Interface TxnLog

All Known Implementing Classes:
FileTxnLog

public interface TxnLog

Interface for reading transaction logs.


Nested Class Summary
static interface TxnLog.TxnIterator
          an iterating interface for reading transaction logs.
 
Method Summary
 void append(org.apache.zookeeper.txn.TxnHeader hdr, Record r)
          Append a request to the transaction log
 void commit()
          commmit the trasaction and make sure they are persisted
 long getDbId()
          the dbid for this transaction log.
 long getLastLoggedZxid()
          the last zxid of the logged transactions.
 TxnLog.TxnIterator read(long zxid)
          Start reading the transaction logs from a given zxid
 void rollLog()
          roll the current log being appended to
 boolean truncate(long zxid)
          truncate the log to get in sync with the leader.
 

Method Detail

rollLog

void rollLog()
             throws IOException
roll the current log being appended to

Throws:
IOException

append

void append(org.apache.zookeeper.txn.TxnHeader hdr,
            Record r)
            throws IOException
Append a request to the transaction log

Parameters:
hdr - the transaction header
r - the transaction itself
Throws:
IOException

read

TxnLog.TxnIterator read(long zxid)
                        throws IOException
Start reading the transaction logs from a given zxid

Parameters:
zxid -
Returns:
returns an iterator to read the next transaction in the logs.
Throws:
IOException

getLastLoggedZxid

long getLastLoggedZxid()
                       throws IOException
the last zxid of the logged transactions.

Returns:
the last zxid of the logged transactions.
Throws:
IOException

truncate

boolean truncate(long zxid)
                 throws IOException
truncate the log to get in sync with the leader.

Parameters:
zxid - the zxid to truncate at.
Throws:
IOException

getDbId

long getDbId()
             throws IOException
the dbid for this transaction log.

Returns:
the dbid for this transaction log.
Throws:
IOException

commit

void commit()
            throws IOException
commmit the trasaction and make sure they are persisted

Throws:
IOException