Package 

Interface CompactBlockRepository

    • Method Summary

      Modifier and Type Method Description
      abstract BlockHeight getLatestHeight() Gets the highest block that is currently stored.
      abstract JniBlockMeta findCompactBlock(BlockHeight height) Fetch the compact block for the given height, if it exists.
      abstract Boolean deleteAllCompactBlockFiles() This function is supposed to be used once the whole blocks sync process done.
      abstract Boolean deleteCompactBlockFiles(List<JniBlockMeta> blocks) This function is supposed to be used continuously while sync process is in progress.
      abstract List<JniBlockMeta> write(Flow<CompactBlockUnsafe> blocks) Write the given flow of blocks to this store, which may be anything from an in-memory cache to a DB.
      abstract Unit rewindTo(BlockHeight height) Remove every block above the given height.
      • Methods inherited from class java.lang.Object

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

      • findCompactBlock

         abstract JniBlockMeta findCompactBlock(BlockHeight height)

        Fetch the compact block for the given height, if it exists.

        Parameters:
        height - of the block we are looking for
      • deleteAllCompactBlockFiles

         abstract Boolean deleteAllCompactBlockFiles()

        This function is supposed to be used once the whole blocks sync process done. It removes all the temporary block files from the device disk.

      • deleteCompactBlockFiles

         abstract Boolean deleteCompactBlockFiles(List<JniBlockMeta> blocks)

        This function is supposed to be used continuously while sync process is in progress. It removes all the temporary block files from the given list of blocks.

        Parameters:
        blocks - list of compact block summary objects of blocks to delete
      • write

         abstract List<JniBlockMeta> write(Flow<CompactBlockUnsafe> blocks)

        Write the given flow of blocks to this store, which may be anything from an in-memory cache to a DB.

        Parameters:
        blocks - Flow of compact blocks to persist
      • rewindTo

         abstract Unit rewindTo(BlockHeight height)

        Remove every block above the given height.

        Parameters:
        height - the target height to which to rewind.