File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,10 @@ pub enum ArchiveCommands {
126126 #[ arg( long) ]
127127 depth : Option < u64 > ,
128128 } ,
129+ SyncBucket {
130+ #[ arg( required = true ) ]
131+ snapshot_files : Vec < PathBuf > ,
132+ } ,
129133}
130134
131135impl ArchiveCommands {
@@ -174,7 +178,7 @@ impl ArchiveCommands {
174178 epoch,
175179 depth,
176180 } => show_tipset_diff ( snapshot_files, epoch, depth) . await ,
177- }
181+ Self :: SyncBucket { snapshot_files } => sync_bucket ( snapshot_files ) . await ,
178182 }
179183}
180184
@@ -581,6 +585,22 @@ async fn show_tipset_diff(
581585 Ok ( ( ) )
582586}
583587
588+ // This command is used for keeping the S3 bucket of archival snapshots
589+ // up-to-date. It takes a set of snapshot files and queries the S3 bucket to see
590+ // what is missing. If the input set of snapshot files can be used to generate
591+ // missing lite or diff snapshots, they'll be generated and uploaded to the S3
592+ // bucket.
593+ async fn sync_bucket ( snapshot_files : Vec < PathBuf > ) -> anyhow:: Result < ( ) > {
594+ // Compute the range of epochs that are covered by the input snapshot files.
595+ let store = ManyCar :: try_from ( snapshot_files) ?;
596+ let heaviest_tipset = store. heaviest_tipset ( ) ?;
597+ let genesis = heaviest_tipset. genesis ( & store) ?;
598+ let network = NetworkChain :: from_genesis_or_devnet_placeholder ( genesis. cid ( ) ) ;
599+
600+
601+ Ok ( ( ) )
602+ }
603+
584604#[ cfg( test) ]
585605mod tests {
586606 use super :: * ;
You can’t perform that action at this time.
0 commit comments