Skip to content

Commit

Permalink
add append for oss
Browse files Browse the repository at this point in the history
Signed-off-by: suyanhanx <suyanhanx@gmail.com>
  • Loading branch information
suyanhanx committed May 23, 2023
1 parent d0498cc commit de59e02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion core/src/services/oss/appender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub struct OssAppender {
}

impl OssAppender {
#[allow(dead_code)]
pub fn new(core: Arc<OssCore>, path: &str, op: OpAppend) -> Self {
Self {
core,
Expand Down
10 changes: 9 additions & 1 deletion core/src/services/oss/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use super::writer::OssWriter;
use crate::ops::*;
use crate::raw::*;
use crate::*;
use crate::services::oss::appender::OssAppender;

const DEFAULT_WRITE_MIN_SIZE: usize = 8 * 1024 * 1024;
/// Aliyun Object Storage Service (OSS) support
Expand Down Expand Up @@ -441,7 +442,7 @@ impl Accessor for OssBackend {
type BlockingReader = ();
type Writer = OssWriter;
type BlockingWriter = ();
type Appender = ();
type Appender = OssAppender;
type Pager = OssPager;
type BlockingPager = ();

Expand Down Expand Up @@ -538,6 +539,13 @@ impl Accessor for OssBackend {
))
}

async fn append(&self, path: &str, args: OpAppend) -> Result<(RpAppend, Self::Appender)> {
Ok((
RpAppend::default(),
OssAppender::new(self.core.clone(), path, args),
))
}

async fn copy(&self, from: &str, to: &str, _args: OpCopy) -> Result<RpCopy> {
let resp = self.core.oss_copy_object(from, to).await?;
let status = resp.status();
Expand Down

0 comments on commit de59e02

Please sign in to comment.