fn check_object_sizes(&self, objects: &[ObjectBuffer<'_>]) -> Result<(), ObjectSendError> {
        for ob in objects {
            let meta_size = ob.meta().len();
            if meta_size as u64 > MAX_META_SIZE {
                let oid: ObjectId = ob.id().to_bytes().try_into().unwrap();
                return Err(ObjectSendError::ObjectMetaTooLarge(
                    self.peer_addr,
                    oid,
                    meta_size,
                ));
            }
            let data_size = ob.data().len();
            if data_size as u64 > MAX_DATA_SIZE {
                let oid: ObjectId = ob.id().to_bytes().try_into().unwrap();
                return Err(ObjectSendError::ObjectDataTooLarge(
                    self.peer_addr,
                    oid,
                    data_size,
                ));
            }
        }
        Ok(())
    }
/// Makes sure that none of the objects in the list is too big (both for data and metadata)
Makes sure that none of the objects in the list is too big (both for data and metadata)
Makes sure that none of the objects in the list is too big ( both for data and metadata )
fn check_object_sizes(&self, objects: &[ObjectBuffer<'_>]) -> Result<(), ObjectSendError> {
        for ob in objects {
            let meta_size = ob.meta().len();
            if meta_size as u64 > MAX_META_SIZE {
                let oid: ObjectId = ob.id().to_bytes().try_into().unwrap();
                return Err(ObjectSendError::ObjectMetaTooLarge(
                    self.peer_addr,
                    oid,
                    meta_size,
                ));
            }
            let data_size = ob.data().len();
            if data_size as u64 > MAX_DATA_SIZE {
                let oid: ObjectId = ob.id().to_bytes().try_into().unwrap();
                return Err(ObjectSendError::ObjectDataTooLarge(
                    self.peer_addr,
                    oid,
                    data_size,
                ));
            }
        }
        Ok(())
    }
fn check_object_sizes ( & self , objects : & [ ObjectBuffer < ' _ > ] ) -> Result < ( ) , ObjectSendError > { for ob in objects { let meta_size = ob . meta ( ) . len ( ) ; if meta_size as u64 > MAX_META_SIZE { let oid : ObjectId = ob . id ( ) . to_bytes ( ) . try_into ( ) . unwrap ( ) ; return Err ( ObjectSendError :: ObjectMetaTooLarge ( self . peer_addr , oid , meta_size , ) ) ; } let data_size = ob . data ( ) . len ( ) ; if data_size as u64 > MAX_DATA_SIZE { let oid : ObjectId = ob . id ( ) . to_bytes ( ) . try_into ( ) . unwrap ( ) ; return Err ( ObjectSendError :: ObjectDataTooLarge ( self . peer_addr , oid , data_size , ) ) ; } } Ok ( ( ) ) }
Makes sure that none of the objects in the list is too big (both for data and metadata)
Makes sure that none of the objects in the list is too big ( both for data and metadata )
&self
objects
&[ObjectBuffer<'_>]
&self
objects
&[ObjectBuffer<'_>]