Class VersionTally

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(long version)
      Add a new block version to the tally, and return the count for that version within the window.
      java.lang.Integer getCountAtOrAbove​(long version)
      Get the count of blocks at or above the given version, within the window.
      void initialize​(BlockStore blockStore, StoredBlock chainHead)
      Initialize the version tally from the block store.
      int size()
      Get the size of the version window.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • add

        public void add​(long version)
        Add a new block version to the tally, and return the count for that version within the window.
        Parameters:
        version - the block version to add.
      • getCountAtOrAbove

        public java.lang.Integer getCountAtOrAbove​(long version)
        Get the count of blocks at or above the given version, within the window.
        Parameters:
        version - the block version to query.
        Returns:
        the count for the block version, or null if the window is not yet full.
      • initialize

        public void initialize​(BlockStore blockStore,
                               StoredBlock chainHead)
                        throws BlockStoreException
        Initialize the version tally from the block store. Note this does not search backwards past the start of the block store, so if starting from a checkpoint this may not fill the window.
        Parameters:
        blockStore - block store to load blocks from.
        chainHead - current chain tip.
        Throws:
        BlockStoreException
      • size

        public int size()
        Get the size of the version window.