async fn put<S>(&self, location: &str, bytes: S, length: usize) -> InternalResult<()>
    where
        S: Stream<Item = io::Result<Bytes>> + Send + Sync + 'static,
    {
        let content = bytes
            .map_ok(|b| bytes::BytesMut::from(&b[..]))
            .try_concat()
            .await
            .context(UnableToPutDataInMemory)?;

        ensure!(
            content.len() == length,
            DataDoesNotMatchLength {
                actual: content.len(),
                expected: length,
            }
        );

        let content = content.freeze();

        self.storage
            .write()
            .await
            .insert(location.to_string(), content);
        Ok(())
    }
/// Save the provided bytes to the specified location.
Save the provided bytes to the specified location.
Save the provided bytes to the specified location .
async fn put<S>(&self, location: &str, bytes: S, length: usize) -> InternalResult<()>
    where
        S: Stream<Item = io::Result<Bytes>> + Send + Sync + 'static,
    {
        let content = bytes
            .map_ok(|b| bytes::BytesMut::from(&b[..]))
            .try_concat()
            .await
            .context(UnableToPutDataInMemory)?;
        ensure!(
            content.len() == length,
            DataDoesNotMatchLength {
                actual: content.len(),
                expected: length,
            }
        );
        let content = content.freeze();
        self.storage
            .write()
            .await
            .insert(location.to_string(), content);
        Ok(())
    }
async fn put < S > ( & self , location : & str , bytes : S , length : usize ) -> InternalResult < ( ) > where S : Stream < Item = io :: Result < Bytes > > + Send + Sync + ' static , { let content = bytes . map_ok ( | b | bytes :: BytesMut :: from ( & b [ .. ] ) ) . try_concat ( ) . await . context ( UnableToPutDataInMemory ) ? ; ensure ! ( content len ( ) length DataDoesNotMatchLength { actual content len ( ) expected length } ) ; let content = content . freeze ( ) ; self . storage . write ( ) . await . insert ( location . to_string ( ) , content ) ; Ok ( ( ) ) }
Save the provided bytes to the specified location.
Save the provided bytes to the specified location .
&self
location
&str
bytes
S
length
usize