Skip to content

Commit e39e978

Browse files
Ilya Bogdanovdmitry-timofeev
authored andcommitted
Support different supervisor modes in exonum-java (#1361)
Add support for "decentralized" supervisor operation mode on top of previously available "simple".
1 parent a1f60a0 commit e39e978

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

exonum-java-binding/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2323
`ProofListIndexProxy.getProof`, `ProofListIndexProxy.getRangeProof` and
2424
`ListProof`.
2525
- `ProofEntryIndexProxy` collection.
26+
- `supervisor-mode` CLI parameter added for `generate-template` command. It
27+
allows to configure the mode of the Supervisor service. Possible values are
28+
"simple" and "decentralized". (#1361)
2629

2730
### Changed
2831
- Transactions are now implemented as service methods annotated with

exonum-java-binding/core/rust/exonum-java/src/node.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
use exonum_explorer_service::ExplorerFactory;
18-
use exonum_supervisor::Supervisor;
18+
use exonum_supervisor::{mode::Mode as SupervisorMode, Supervisor};
1919
use exonum_time::TimeServiceFactory;
2020
use java_bindings::{
2121
create_java_vm, create_service_runtime,
@@ -70,7 +70,7 @@ fn create_blockchain(
7070

7171
let blockchain = Blockchain::new(database, keypair, api_sender);
7272

73-
let supervisor_service = supervisor_service();
73+
let supervisor_service = supervisor_service(&config);
7474
let genesis_config = GenesisConfigBuilder::with_consensus_config(node_config.consensus)
7575
.with_artifact(Supervisor.artifact_id())
7676
.with_instance(supervisor_service)
@@ -113,6 +113,15 @@ fn create_database(config: &Config) -> Result<Arc<dyn Database>, failure::Error>
113113
Ok(database)
114114
}
115115

116-
fn supervisor_service() -> InstanceInitParams {
117-
Supervisor::simple()
116+
fn supervisor_service(config: &Config) -> InstanceInitParams {
117+
let mode = &config
118+
.run_config
119+
.node_config
120+
.public_config
121+
.general
122+
.supervisor_mode;
123+
match *mode {
124+
SupervisorMode::Simple => Supervisor::simple(),
125+
SupervisorMode::Decentralized => Supervisor::decentralized(),
126+
}
118127
}

0 commit comments

Comments
 (0)