TxnLogProposalIterator (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.server

## Class TxnLogProposalIterator

- java.lang.Object
- - org.apache.zookeeper.server.TxnLogProposalIterator

- All Implemented Interfaces:
    Iterator<Leader.Proposal>

      public class TxnLogProposalIterator
      extends Object
      implements Iterator<Leader.Proposal>

  This class provides an iterator interface to access Proposal deserialized from on-disk txnlog. The iterator deserializes one proposal at a time to reduce memory footprint. Note that the request part of the proposal is not initialized and set to null since we don't need it during follower sync-up.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TxnLogProposalIterator` | `EMPTY_ITERATOR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TxnLogProposalIterator(TxnLog.TxnIterator itr)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the files and release the resources which are used for iterating transaction records
    `boolean` | `hasNext()`
    `Leader.Proposal` | `next()` Proposal returned by this iterator has request part set to null, since it is not used for follower sync-up.
    `void` | `remove()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining`

- - ### Field Detail

    - #### EMPTY_ITERATOR

          public static final TxnLogProposalIterator EMPTY_ITERATOR

  - ### Constructor Detail

    - #### TxnLogProposalIterator

          public TxnLogProposalIterator(TxnLog.TxnIterator itr)

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<Leader.Proposal>`

    - #### next

          public Leader.Proposal next()

      Proposal returned by this iterator has request part set to null, since it is not used for follower sync-up.
      Specified by:
        `next` in interface `Iterator<Leader.Proposal>`

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `Iterator<Leader.Proposal>`

    - #### close

          public void close()

      Close the files and release the resources which are used for iterating transaction records

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.