forked from nervosnetwork/ckb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from EthanYuan/v0.116.1-branch-chain-separatio…
…n-aggregator separation aggregator
- Loading branch information
Showing
24 changed files
with
537 additions
and
266 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
README.md | ||
ckb.toml | ||
ckb-miner.toml | ||
ckb-aggregator.toml | ||
target/ | ||
data/ | ||
specs/ | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,36 @@ | ||
use branch_chain_aggregator::Aggregator; | ||
use ckb_app_config::{AggregatorArgs, ExitCode}; | ||
use ckb_logger::info; | ||
use ckb_stop_handler::{ | ||
broadcast_exit_signals, new_crossbeam_exit_rx, register_thread, wait_all_ckb_services_exit, | ||
}; | ||
|
||
use std::thread; | ||
use std::time::Duration; | ||
|
||
pub fn aggregator(args: AggregatorArgs, chain_id: String) -> Result<(), ExitCode> { | ||
info!("chain id: {}", chain_id); | ||
|
||
let aggregator = Aggregator::new(args.config, Duration::from_secs(2), chain_id); | ||
|
||
let stop_rx = new_crossbeam_exit_rx(); | ||
const THREAD_NAME: &str = "Aggregator"; | ||
let aggregator_jh = thread::Builder::new() | ||
.name(THREAD_NAME.into()) | ||
.spawn(move || { | ||
aggregator.run(stop_rx); | ||
}) | ||
.expect("Start aggregator failed!"); | ||
register_thread(THREAD_NAME, aggregator_jh); | ||
|
||
info!("Branch Aggregator service started ..."); | ||
ctrlc::set_handler(|| { | ||
info!("Trapped exit signal, exiting..."); | ||
broadcast_exit_signals(); | ||
}) | ||
.expect("Error setting Ctrl-C handler"); | ||
|
||
wait_all_ckb_services_exit(); | ||
|
||
Ok(()) | ||
} |
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
Oops, something went wrong.