fn store_artifacts(artifacts: Vec<ConsensusMessage>, path: &Path) -> Result<(), io::Error> {
    use ConsensusMessage::*;
    artifacts
        .into_iter()
        .filter_map(|artifact| match artifact {
            Finalization(artifact) => Some(BackupArtifact::Finalization(Box::new(artifact))),
            Notarization(artifact) => Some(BackupArtifact::Notarization(Box::new(artifact))),
            BlockProposal(artifact) => Some(BackupArtifact::BlockProposal(Box::new(artifact))),
            RandomTape(artifact) => Some(BackupArtifact::RandomTape(Box::new(artifact))),
            RandomBeacon(artifact) => Some(BackupArtifact::RandomBeacon(Box::new(artifact))),
            CatchUpPackage(artifact) => Some(BackupArtifact::CatchUpPackage(Box::new(artifact))),
            // Do not replace by a `_` so that we evaluate at this place if we want to
            // backup a new artifact!
            RandomBeaconShare(_)
            | NotarizationShare(_)
            | FinalizationShare(_)
            | RandomTapeShare(_)
            | CatchUpPackageShare(_) => None,
        })
        .try_for_each(|artifact| artifact.write_to_disk(path))
}
// Write all backup files to the disk. For the sake of simplicity, we write all
// artifacts sequentially.
Write all backup files to the disk. For the sake of simplicity, we write all
artifacts sequentially.
Write all backup files to the disk . For the sake of simplicity we write all artifacts sequentially .
fn store_artifacts(artifacts: Vec<ConsensusMessage>, path: &Path) -> Result<(), io::Error> {
    use ConsensusMessage::*;
    artifacts
        .into_iter()
        .filter_map(|artifact| match artifact {
            Finalization(artifact) => Some(BackupArtifact::Finalization(Box::new(artifact))),
            Notarization(artifact) => Some(BackupArtifact::Notarization(Box::new(artifact))),
            BlockProposal(artifact) => Some(BackupArtifact::BlockProposal(Box::new(artifact))),
            RandomTape(artifact) => Some(BackupArtifact::RandomTape(Box::new(artifact))),
            RandomBeacon(artifact) => Some(BackupArtifact::RandomBeacon(Box::new(artifact))),
            CatchUpPackage(artifact) => Some(BackupArtifact::CatchUpPackage(Box::new(artifact))),
            // Do not replace by a `_` so that we evaluate at this place if we want to
            // backup a new artifact!
            RandomBeaconShare(_)
            | NotarizationShare(_)
            | FinalizationShare(_)
            | RandomTapeShare(_)
            | CatchUpPackageShare(_) => None,
        })
        .try_for_each(|artifact| artifact.write_to_disk(path))
}
fn store_artifacts ( artifacts : Vec < ConsensusMessage > , path : & Path ) -> Result < ( ) , io :: Error > { use ConsensusMessage :: * ; artifacts . into_iter ( ) . filter_map ( | artifact | match artifact { Finalization ( artifact ) => Some ( BackupArtifact :: Finalization ( Box :: new ( artifact ) ) ) , Notarization ( artifact ) => Some ( BackupArtifact :: Notarization ( Box :: new ( artifact ) ) ) , BlockProposal ( artifact ) => Some ( BackupArtifact :: BlockProposal ( Box :: new ( artifact ) ) ) , RandomTape ( artifact ) => Some ( BackupArtifact :: RandomTape ( Box :: new ( artifact ) ) ) , RandomBeacon ( artifact ) => Some ( BackupArtifact :: RandomBeacon ( Box :: new ( artifact ) ) ) , CatchUpPackage ( artifact ) => Some ( BackupArtifact :: CatchUpPackage ( Box :: new ( artifact ) ) ) , // Do not replace by a `_` so that we evaluate at this place if we want to // backup a new artifact! RandomBeaconShare ( _ ) | NotarizationShare ( _ ) | FinalizationShare ( _ ) | RandomTapeShare ( _ ) | CatchUpPackageShare ( _ ) => None , } ) . try_for_each ( | artifact | artifact . write_to_disk ( path ) ) }
Write all backup files to the disk.
Write all backup files to the disk .
artifacts
Vec<ConsensusMessage>
path
&Path
artifacts
Vec<ConsensusMessage>
path
&Path