-
public interface CompactBlockRepositoryInterface for storing compact blocks.
-
-
Method Summary
Modifier and Type Method Description abstract BlockHeightgetLatestHeight()Gets the highest block that is currently stored. abstract JniBlockMetafindCompactBlock(BlockHeight height)Fetch the compact block for the given height, if it exists. abstract BooleandeleteAllCompactBlockFiles()This function is supposed to be used once the whole blocks sync process done. abstract BooleandeleteCompactBlockFiles(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 UnitrewindTo(BlockHeight height)Remove every block above the given height. -
-
Method Detail
-
getLatestHeight
abstract BlockHeight getLatestHeight()
Gets the highest block that is currently stored.
-
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.
-
-
-
-