BlockTimestampSlicer
Documentation for eth_defi.event_reader.timestamp_cache.BlockTimestampSlicer Python class.
- class BlockTimestampSlicer
Bases:
objectRead timestamps from DuckDB in slices iteratively.
Maintain a memory buffer of block numbers
Avoid reading all Arbitrum 20 GB of timestamp data to memory at once
Methods summary
__init__(timestamp_db[, slice_size])close()Release the associated cache db.
get(block_number)Get timestamp for a given block number, or None if not found.
Get the maximum block number in the database.
- __init__(timestamp_db, slice_size=1000000)
- Parameters
timestamp_db (eth_defi.event_reader.timestamp_cache.BlockTimestampDatabase) –
slice_size (int) –
- get(block_number)
Get timestamp for a given block number, or None if not found.
- Parameters
block_number (int) –
- Return type
datetime.datetime | None
- get_last_block()
Get the maximum block number in the database.
- Return type
- close()
Release the associated cache db.