diff --git a/node/src/client/builder.rs b/node/src/client/builder.rs index 4d742e1..dbbe590 100644 --- a/node/src/client/builder.rs +++ b/node/src/client/builder.rs @@ -2,7 +2,7 @@ use super::{Client, RuntimeContext}; use chunk_pool::{ChunkPoolMessage, Config as ChunkPoolConfig, MemoryChunkPool}; use file_location_cache::FileLocationCache; use log_entry_sync::{LogSyncConfig, LogSyncEvent, LogSyncManager}; -use miner::{MineService, MinerConfig, MinerMessage}; +use miner::{MineService, MinerConfig, MinerMessage, ShardConfig}; use network::{ self, Keypair, NetworkConfig, NetworkGlobals, NetworkMessage, RequestId, Service as LibP2PService, @@ -216,6 +216,16 @@ impl ClientBuilder { Ok(self) } + pub async fn with_shard(self, config: ShardConfig) -> Result { + self.async_store + .as_ref() + .unwrap() + .update_shard_config(config) + .await; + + Ok(self) + } + /// Starts the networking stack. pub fn with_router(mut self, router_config: router::Config) -> Result { let executor = require!("router", self, runtime_context).clone().executor; diff --git a/node/src/config/convert.rs b/node/src/config/convert.rs index e871b84..34dc3d3 100644 --- a/node/src/config/convert.rs +++ b/node/src/config/convert.rs @@ -228,7 +228,7 @@ impl ZgsConfig { } } - fn shard_config(&self) -> Result { + pub fn shard_config(&self) -> Result { self.shard_position.clone().try_into() } } diff --git a/node/src/main.rs b/node/src/main.rs index cfac0b7..a73b26c 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -17,6 +17,7 @@ async fn start_node(context: RuntimeContext, config: ZgsConfig) -> Result Result