@@ -7,9 +7,7 @@ use std::{net::SocketAddr, path::PathBuf, time::Duration};
77
88use eyre:: Result ;
99use iroh:: EndpointAddr ;
10- use sedimentree_core:: {
11- commit:: CountLeadingZeroBytes , id:: SedimentreeId , sedimentree:: Sedimentree ,
12- } ;
10+ use sedimentree_core:: commit:: CountLeadingZeroBytes ;
1311use sedimentree_fs_storage:: FsStorage ;
1412use subduction_core:: {
1513 connection:: {
@@ -18,9 +16,8 @@ use subduction_core::{
1816 } ,
1917 peer:: id:: PeerId ,
2018 policy:: open:: OpenPolicy ,
21- sharded_map:: ShardedMap ,
2219 storage:: metrics:: { MetricsStorage , RefreshMetrics } ,
23- subduction:: { Subduction , pending_blob_requests :: DEFAULT_MAX_PENDING_BLOB_REQUESTS } ,
20+ subduction:: { Subduction , builder :: SubductionBuilder } ,
2421 timestamp:: TimestampSeconds ,
2522} ;
2623use subduction_crypto:: { nonce:: Nonce , signer:: memory:: MemorySigner } ;
@@ -203,20 +200,18 @@ pub(crate) async fn run(args: ServerArgs, token: CancellationToken) -> Result<()
203200 let discovery_id = Some ( DiscoveryId :: new ( service_name. as_bytes ( ) ) ) ;
204201 let discovery_audience: Option < Audience > = discovery_id. map ( Audience :: discover_id) ;
205202
206- let sedimentrees: ShardedMap < SedimentreeId , Sedimentree > = ShardedMap :: new ( ) ;
203+ // Build the Subduction instance with all defaults
204+ let mut builder = SubductionBuilder :: new ( )
205+ . signer ( signer. clone ( ) )
206+ . storage ( storage, Arc :: new ( OpenPolicy ) )
207+ . spawner ( TokioSpawn ) ;
207208
208- // Create the unified Subduction instance (parameterized over UnifiedTransport)
209- let ( subduction, listener_fut, manager_fut) : ( CliSubduction , _ , _ ) = Subduction :: new (
210- discovery_id,
211- signer. clone ( ) ,
212- storage,
213- OpenPolicy ,
214- NonceCache :: default ( ) ,
215- CountLeadingZeroBytes ,
216- sedimentrees,
217- TokioSpawn ,
218- DEFAULT_MAX_PENDING_BLOB_REQUESTS ,
219- ) ;
209+ if let Some ( id) = discovery_id {
210+ builder = builder. discovery_id ( id) ;
211+ }
212+
213+ let ( subduction, _handler, listener_fut, manager_fut) : ( CliSubduction , _ , _ , _ ) =
214+ builder. build ( ) ;
220215
221216 let server_peer_id = subduction. peer_id ( ) ;
222217
0 commit comments