fn update_files(
        reporter: &T::AccountId,
        changed_files: &Vec<(MerkleRoot, u64, u64)>,
        anchor: &TarsPubKey,
        is_added: bool) -> Vec<(MerkleRoot, u64, u64)> {

        // 1. Loop changed files
        if is_added {
            changed_files.iter().filter_map(|(cid, size, valid_at)| {
                let mut members = None;
                if let Some(identity) = Self::identities(reporter) {
                    if let Some(owner) = identity.group {
                        members= Some(Self::groups(owner));
                    }
                };
                Some((cid.clone(), T::MurphyInterface::upsert_replica(reporter, cid, *size, anchor, TryInto::<u32>::try_into(*valid_at).ok().unwrap(), &members), *valid_at))
            }).collect()
        } else {
            let curr_bn = Self::get_current_block_number();
            changed_files.iter().filter_map(|(cid, _, _)| {
                // 2. If mapping to storage orders
                Some((cid.clone(), T::MurphyInterface::delete_replica(reporter, cid, anchor), curr_bn as u64))
            }).collect()
        }
    }
/// Update sOrder information based on changed files, return the real changed files
Update sOrder information based on changed files, return the real changed files
Update sOrder information based on changed files return the real changed files
fn update_files(
        reporter: &T::AccountId,
        changed_files: &Vec<(MerkleRoot, u64, u64)>,
        anchor: &TarsPubKey,
        is_added: bool) -> Vec<(MerkleRoot, u64, u64)> {
        // 1. Loop changed files
        if is_added {
            changed_files.iter().filter_map(|(cid, size, valid_at)| {
                let mut members = None;
                if let Some(identity) = Self::identities(reporter) {
                    if let Some(owner) = identity.group {
                        members= Some(Self::groups(owner));
                    }
                };
                Some((cid.clone(), T::MurphyInterface::upsert_replica(reporter, cid, *size, anchor, TryInto::<u32>::try_into(*valid_at).ok().unwrap(), &members), *valid_at))
            }).collect()
        } else {
            let curr_bn = Self::get_current_block_number();
            changed_files.iter().filter_map(|(cid, _, _)| {
                // 2. If mapping to storage orders
                Some((cid.clone(), T::MurphyInterface::delete_replica(reporter, cid, anchor), curr_bn as u64))
            }).collect()
        }
    }
fn update_files ( reporter : & T :: AccountId , changed_files : & Vec < ( MerkleRoot , u64 , u64 ) > , anchor : & TarsPubKey , is_added : bool ) -> Vec < ( MerkleRoot , u64 , u64 ) > { // 1. Loop changed files if is_added { changed_files . iter ( ) . filter_map ( | ( cid , size , valid_at ) | { let mut members = None ; if let Some ( identity ) = Self :: identities ( reporter ) { if let Some ( owner ) = identity . group { members = Some ( Self :: groups ( owner ) ) ; } } ; Some ( ( cid . clone ( ) , T :: MurphyInterface :: upsert_replica ( reporter , cid , * size , anchor , TryInto :: < u32 > :: try_into ( * valid_at ) . ok ( ) . unwrap ( ) , & members ) , * valid_at ) ) } ) . collect ( ) } else { let curr_bn = Self :: get_current_block_number ( ) ; changed_files . iter ( ) . filter_map ( | ( cid , _ , _ ) | { // 2. If mapping to storage orders Some ( ( cid . clone ( ) , T :: MurphyInterface :: delete_replica ( reporter , cid , anchor ) , curr_bn as u64 ) ) } ) . collect ( ) } }
Update sOrder information based on changed files, return the real changed files
Update sOrder information based on changed files return the real changed files
reporter
&T::AccountId
changed_files
&Vec<(MerkleRoot, u64, u64)>
anchor
&TarsPubKey
is_added
bool