HomePhabricator

[Chronik] Implement FailoverProxy structure when interacting with Chronik in…

Description

[Chronik] Implement FailoverProxy structure when interacting with Chronik in rust

Summary:
This diff adds failover.rs into bitcoinsuite-chronik-client. This file contains logic so that when we create a ChronikClient struct, it only contains one field: failover. This failover stores our client, our endpoints and working index. This allows us to keep track of multiple different endpoints that are accessible, so that in the future we can cycle to them upon downtime of one endpoint. The working index keeps track of which endpoint we are currently connected to. By having separate functions for FailoverProxy and ChronikClient, we are able to seperate the logic between the two, so that the FailoverProxy can focus on failover recovery, whereas the ChronikClient can focus on client functionality.

The cycling of endpoints upon endpoint failure will be added in a future diff.

Test Plan:
Please set BUILD_DIR env to export BUILD_DIR="/path/to/build_dir
UNIX: ./contrib/teamcity/build-configurations.py build-bitcoinsuite-chronik-client
run cargo test -- --nocapture in bitcoin-abc/modules/bitcoinsuite-chronik-client/tests

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Subscribers: alitayin, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18318

Details

Provenance
hazzarustAuthored on Jun 9 2025, 11:08
hazzarustPushed on Jul 17 2025, 13:00
Reviewer
Restricted Owners Package
Differential Revision
D18318: [Chronik] Implement FailoverProxy structure when interacting with Chronik in rust
Parents
rABC2f05cc1ec135: [avalanche] Only mine the finalized txs
Branches
Unknown
Tags
Unknown