-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create storage functions for handling reorgs (#90)
### TL;DR Added support for chain reorganization detection and handling in the storage layer. ### What changed? - Introduced a new `BlockHeader` struct in `block.go` - Added methods to `ClickHouseConnector` for managing reorg checks and block headers - Implemented `GetLastReorgCheckedBlockNumber` and `SetLastReorgCheckedBlockNumber` in storage connectors - Added `LookbackBlockHeaders` and `DeleteDataForBlocks` methods to `IMainStorage` interface - Updated `MemoryConnector` to support new reorg-related operations - Added reorg check functionality to `RedisConnector` - Created a new SQL script for a `cursors` table in ClickHouse - Modified the staging table creation script to remove the primary key
- Loading branch information
Showing
7 changed files
with
221 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE TABLE cursors ( | ||
`chain_id` UInt256, | ||
`cursor_type` String, | ||
`cursor_value` String, | ||
`insert_timestamp` DateTime DEFAULT now(), | ||
) ENGINE = ReplacingMergeTree(insert_timestamp) | ||
ORDER BY (chain_id, cursor_type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters