Interface TxnLog

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    FileTxnLog

    public interface TxnLog
    extends java.io.Closeable
    Interface for reading transaction logs.
    • Method Detail

      • setServerStats

        void setServerStats​(ServerStats serverStats)
        Setter for ServerStats to monitor fsync threshold exceed
        Parameters:
        serverStats - used to update fsyncThresholdExceedCount
      • rollLog

        void rollLog()
              throws java.io.IOException
        roll the current log being appended to
        Throws:
        java.io.IOException
      • append

        boolean append​(TxnHeader hdr,
                       Record r)
                throws java.io.IOException
        Append a request to the transaction log
        Parameters:
        hdr - the transaction header
        r - the transaction itself
        Returns:
        true iff something appended, otw false
        Throws:
        java.io.IOException
      • append

        boolean append​(TxnHeader hdr,
                       Record r,
                       TxnDigest digest)
                throws java.io.IOException
        Append a request to the transaction log with a digset
        Parameters:
        hdr - the transaction header
        r - the transaction itself
        digest - transaction digest returns true iff something appended, otw false
        Throws:
        java.io.IOException
      • read

        TxnLog.TxnIterator read​(long zxid)
                         throws java.io.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:
        java.io.IOException
      • getLastLoggedZxid

        long getLastLoggedZxid()
                        throws java.io.IOException
        the last zxid of the logged transactions.
        Returns:
        the last zxid of the logged transactions.
        Throws:
        java.io.IOException
      • truncate

        boolean truncate​(long zxid)
                  throws java.io.IOException
        truncate the log to get in sync with the leader.
        Parameters:
        zxid - the zxid to truncate at.
        Throws:
        java.io.IOException
      • getDbId

        long getDbId()
              throws java.io.IOException
        the dbid for this transaction log.
        Returns:
        the dbid for this transaction log.
        Throws:
        java.io.IOException
      • commit

        void commit()
             throws java.io.IOException
        commit the transaction and make sure they are persisted
        Throws:
        java.io.IOException
      • getTxnLogSyncElapsedTime

        long getTxnLogSyncElapsedTime()
        Returns:
        transaction log's elapsed sync time in milliseconds
      • close

        void close()
            throws java.io.IOException
        close the transactions logs
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • setTotalLogSize

        void setTotalLogSize​(long size)
        Sets the total size of all log files
      • getTotalLogSize

        long getTotalLogSize()
        Gets the total size of all log files