@@ -13,7 +13,7 @@ use clap::{Args, Subcommand};
1313use futures:: { stream:: BoxStream , StreamExt } ;
1414use multihash_codetable:: { Code , Multihash , MultihashDigest } ;
1515use tokio:: io:: AsyncBufReadExt ;
16- use tracing:: { debug, info} ;
16+ use tracing:: { debug, info, warn } ;
1717
1818use crate :: { default_directory, DBOpts , Info , LogOpts , Network } ;
1919
@@ -66,13 +66,14 @@ pub struct FromIpfsOpts {
6666 #[ command( flatten) ]
6767 log_opts : LogOpts ,
6868
69- /// Path of file containing list of newline-delimited file paths to migrate.
69+ /// Path of file containing list of newline-delimited paths to blocks to migrate. The paths must either be absolute,
70+ /// or relative to the current directory where the migration command is run.
7071 ///
7172 /// See below for example usage when running a migration for a live IPFS node. Multiple migration runs using lists
7273 /// of files that have changed between runs is useful for incremental migrations. This method can also be used for
7374 /// a final migration after shutting down the IPFS node so that all inflight blocks are migrated to the new C1 node.
7475 ///
75- /// # Get list of files in sorted order
76+ /// # Get list of absolute file paths to blocks, in sorted order
7677 ///
7778 /// find ~/.ipfs/blocks -type f | sort > first_run_files.txt
7879 ///
@@ -95,6 +96,8 @@ pub struct FromIpfsOpts {
9596 input_file_list_path : Option < PathBuf > ,
9697
9798 /// Offset within the input files to start from
99+ ///
100+ /// Note: this is useful for resuming a migration from a previous run that was interrupted.
98101 #[ clap(
99102 long,
100103 short = 's' ,
@@ -109,7 +112,9 @@ pub struct FromIpfsOpts {
109112
110113 /// Optional list of model stream ids. Only events from these models will be migrated.
111114 /// If the list is empty all events are migrated.
112- /// The 'metamodel' stream id is `kh4q0ozorrgaq2mezktnrmdwleo1d` if you want to migrate models.
115+ ///
116+ /// Note: if filtering, you likely also want to include the metamodel stream id
117+ /// (kh4q0ozorrgaq2mezktnrmdwleo1d), so the actual model streams are also included in the migration.
113118 #[ clap( long, value_delimiter = ',' , env = "CERAMIC_ONE_MODEL_FILTER" ) ]
114119 model_filter : Vec < String > ,
115120
@@ -119,8 +124,11 @@ pub struct FromIpfsOpts {
119124 validate_signatures : bool ,
120125
121126 /// Whether to validate the chain of time events matches the expected CAIP2 chain id.
122- /// Events with invalid chains will be skipped and counted as errors.
123- /// For example, on mainnet, events are expected to have a chain id of 'eip155:1'.
127+ ///
128+ /// Events with proofs from invalid chains will be skipped and counted as errors.
129+ /// For example, if some blocks being imported were anchored against an inmemory
130+ /// store or a different network than configured with the `--network` option.
131+ /// On mainnet, events are expected to have a chain id of 'eip155:1'.
124132 #[ clap( long, env = "CERAMIC_ONE_VALIDATE_CHAIN" ) ]
125133 validate_chain : bool ,
126134
@@ -350,17 +358,18 @@ impl FSBlockStore {
350358
351359async fn block_from_path ( block_path : PathBuf ) -> Result < Option < ( Cid , Vec < u8 > ) > > {
352360 if !block_path. is_file ( ) {
361+ warn ! ( path = %block_path. display( ) , relative_path = %!block_path. is_absolute( ) , "block file not found, skipping" ) ;
353362 return Ok ( None ) ;
354363 }
355364
356365 let Ok ( ( _base, hash_bytes) ) =
357366 multibase:: decode ( "B" . to_string ( ) + block_path. file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) )
358367 else {
359- debug ! ( path = %block_path. display( ) , "block filename is not valid base32upper" ) ;
368+ warn ! ( path = %block_path. display( ) , "block filename is not valid base32upper, skipping " ) ;
360369 return Ok ( None ) ;
361370 } ;
362371 let Ok ( hash) = Multihash :: from_bytes ( & hash_bytes) else {
363- debug ! ( path = %block_path. display( ) , "block filename is not a valid multihash" ) ;
372+ warn ! ( path = %block_path. display( ) , "block filename is not a valid multihash, skipping " ) ;
364373 return Ok ( None ) ;
365374 } ;
366375 let blob = tokio:: fs:: read ( & block_path) . await ?;
0 commit comments