This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch stream-based-write in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit dc3a974ddd8780f4c2d348df872d1dad63b7d693 Author: Xuanwo <[email protected]> AuthorDate: Wed Aug 30 18:49:06 2023 +0800 Migrate vecerl Signed-off-by: Xuanwo <[email protected]> --- core/src/services/vercel_artifacts/writer.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/core/src/services/vercel_artifacts/writer.rs b/core/src/services/vercel_artifacts/writer.rs index 71f3e2606..3e6746cd0 100644 --- a/core/src/services/vercel_artifacts/writer.rs +++ b/core/src/services/vercel_artifacts/writer.rs @@ -35,14 +35,17 @@ impl VercelArtifactsWriter { pub fn new(backend: VercelArtifactsBackend, op: OpWrite, path: String) -> Self { VercelArtifactsWriter { backend, op, path } } +} - async fn write(&mut self, bs: Bytes) -> Result<()> { +#[async_trait] +impl oio::Write for VercelArtifactsWriter { + async fn write(&mut self, s: oio::Streamer) -> Result<()> { let resp = self .backend .vercel_artifacts_put( self.path.as_str(), self.op.content_length().unwrap(), - AsyncBody::Bytes(bs), + AsyncBody::Stream(s), ) .await?; @@ -56,16 +59,6 @@ impl VercelArtifactsWriter { _ => Err(parse_error(resp).await?), } } -} - -#[async_trait] -impl oio::Write for VercelArtifactsWriter { - async fn write(&mut self, _s: oio::Streamer) -> Result<()> { - Err(Error::new( - ErrorKind::Unsupported, - "Write::sink is not supported", - )) - } async fn abort(&mut self) -> Result<()> { Ok(())
