use std::sync::Arc;
use http::StatusCode;
use super::core::*;
use super::error::parse_error;
use opendal_core::raw::*;
use opendal_core::*;
pub struct ObsDeleter {
core: Arc<ObsCore>,
}
impl ObsDeleter {
pub fn new(core: Arc<ObsCore>) -> Self {
Self { core }
}
}
impl oio::OneShotDelete for ObsDeleter {
async fn delete_once(&self, path: String, _: OpDelete) -> Result<()> {
let resp = self.core.obs_delete_object(&path).await?;
let status = resp.status();
match status {
StatusCode::NO_CONTENT | StatusCode::ACCEPTED | StatusCode::NOT_FOUND => Ok(()),
_ => Err(parse_error(resp)),
}
}
}