pub fn spawn(self) -> Instrumented<JoinHandle<Result<()>>> {
        let span = info_span!(
            "ProofPusher",
            bucket = %self.bucket,
            region = self.region.name(),
            home = %self.name,
        );
        tokio::spawn(async move {
            let mut index = 0;
            loop {
                let proof = self.db.proof_by_leaf_index(index)?;
                match proof {
                    Some(proof) => {
                        let message = self
                            .db
                            .message_by_leaf_index(index)?
                            .ok_or_else(|| eyre!("Missing message for known proof"))?;
                        let proven = ProvenMessage {
                            proof,
                            message: message.to_vec(),
                        };
                        // upload if not already present
                        if !self.already_uploaded(&proven).await? {
                            self.upload_proof(&proven).await?;
                        }

                        index += 1;
                    }
                    None => sleep(Duration::from_millis(500)).await,
                }
            }
        })
        .instrument(span)
    }
/// Spawn the pusher task and return a joinhandle
///
/// The pusher task polls the DB for new proofs and attempts to push them
/// to an S3 bucket
Spawn the pusher task and return a joinhandle
The pusher task polls the DB for new proofs and attempts to push them
to an S3 bucket
Spawn the pusher task and return a joinhandle The pusher task polls the DB for new proofs and attempts to push them to an S3 bucket
pub fn spawn(self) -> Instrumented<JoinHandle<Result<()>>> {
        let span = info_span!(
            "ProofPusher",
            bucket = %self.bucket,
            region = self.region.name(),
            home = %self.name,
        );
        tokio::spawn(async move {
            let mut index = 0;
            loop {
                let proof = self.db.proof_by_leaf_index(index)?;
                match proof {
                    Some(proof) => {
                        let message = self
                            .db
                            .message_by_leaf_index(index)?
                            .ok_or_else(|| eyre!("Missing message for known proof"))?;
                        let proven = ProvenMessage {
                            proof,
                            message: message.to_vec(),
                        };
                        // upload if not already present
                        if !self.already_uploaded(&proven).await? {
                            self.upload_proof(&proven).await?;
                        }
                        index += 1;
                    }
                    None => sleep(Duration::from_millis(500)).await,
                }
            }
        })
        .instrument(span)
    }
pub fn spawn ( self ) -> Instrumented < JoinHandle < Result < ( ) > > > { let span = info_span ! ( " " bucket self bucket region self region name ( ) home self name ) ; tokio :: spawn ( async move { let mut index = 0 ; loop { let proof = self . db . proof_by_leaf_index ( index ) ? ; match proof { Some ( proof ) => { let message = self . db . message_by_leaf_index ( index ) ? . ok_or_else ( | | eyre ! ( " " ) ) ? ; let proven = ProvenMessage { proof , message : message . to_vec ( ) , } ; // upload if not already present if ! self . already_uploaded ( & proven ) . await ? { self . upload_proof ( & proven ) . await ? ; } index += 1 ; } None => sleep ( Duration :: from_millis ( 500 ) ) . await , } } } ) . instrument ( span ) }
Spawn the pusher task and return a joinhandle
The pusher task polls the DB for new proofs and attempts to push them
to an S3 bucket
Spawn the pusher task and return a joinhandle The pusher task polls the DB for new proofs and attempts to push them to an S3 bucket
self
self