Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions core/src/services/aliyun_drive/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use http::StatusCode;
use log::debug;
use tokio::sync::Mutex;

use super::DEFAULT_SCHEME;
use super::ALIYUN_DRIVE_SCHEME;
use super::core::*;
use super::delete::AliyunDriveDeleter;
use super::error::parse_error;
Expand All @@ -35,25 +35,14 @@ use super::writer::AliyunDriveWriter;
use crate::raw::*;
use crate::services::AliyunDriveConfig;
use crate::*;
impl Configurator for AliyunDriveConfig {
type Builder = AliyunDriveBuilder;

#[allow(deprecated)]
fn into_builder(self) -> Self::Builder {
AliyunDriveBuilder {
config: self,
http_client: None,
}
}
}

#[doc = include_str!("docs.md")]
#[derive(Default)]
pub struct AliyunDriveBuilder {
config: AliyunDriveConfig,
pub(super) config: AliyunDriveConfig,

#[deprecated(since = "0.53.0", note = "Use `Operator::update_http_client` instead")]
http_client: Option<HttpClient>,
pub(super) http_client: Option<HttpClient>,
}

impl Debug for AliyunDriveBuilder {
Expand Down Expand Up @@ -175,7 +164,7 @@ impl Builder for AliyunDriveBuilder {
core: Arc::new(AliyunDriveCore {
info: {
let am = AccessorInfo::default();
am.set_scheme(DEFAULT_SCHEME)
am.set_scheme(ALIYUN_DRIVE_SCHEME)
.set_root(&root)
.set_native_capability(Capability {
stat: true,
Expand Down
13 changes: 13 additions & 0 deletions core/src/services/aliyun_drive/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use std::fmt::Debug;
use std::fmt::Formatter;

use super::backend::AliyunDriveBuilder;
use serde::Deserialize;
use serde::Serialize;

Expand Down Expand Up @@ -70,3 +71,15 @@ impl Debug for AliyunDriveConfig {
d.finish_non_exhaustive()
}
}

impl crate::Configurator for AliyunDriveConfig {
type Builder = AliyunDriveBuilder;

#[allow(deprecated)]
fn into_builder(self) -> Self::Builder {
AliyunDriveBuilder {
config: self,
http_client: None,
}
}
}
10 changes: 1 addition & 9 deletions core/src/services/aliyun_drive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,14 @@
// under the License.

/// Default scheme for aliyun_drive service.
#[cfg(feature = "services-aliyun-drive")]
pub(super) const DEFAULT_SCHEME: &str = "aliyun_drive";
#[cfg(feature = "services-aliyun-drive")]
pub(super) const ALIYUN_DRIVE_SCHEME: &str = "aliyun_drive";
mod core;

#[cfg(feature = "services-aliyun-drive")]
mod backend;
#[cfg(feature = "services-aliyun-drive")]
mod delete;
#[cfg(feature = "services-aliyun-drive")]
mod error;
#[cfg(feature = "services-aliyun-drive")]
mod lister;
#[cfg(feature = "services-aliyun-drive")]
mod writer;
#[cfg(feature = "services-aliyun-drive")]
pub use backend::AliyunDriveBuilder as AliyunDrive;

mod config;
Expand Down
19 changes: 4 additions & 15 deletions core/src/services/alluxio/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::sync::Arc;
use http::Response;
use log::debug;

use super::DEFAULT_SCHEME;
use super::ALLUXIO_SCHEME;
use super::core::AlluxioCore;
use super::delete::AlluxioDeleter;
use super::error::parse_error;
Expand All @@ -32,26 +32,15 @@ use super::writer::AlluxioWriters;
use crate::raw::*;
use crate::services::AlluxioConfig;
use crate::*;
impl Configurator for AlluxioConfig {
type Builder = AlluxioBuilder;

#[allow(deprecated)]
fn into_builder(self) -> Self::Builder {
AlluxioBuilder {
config: self,
http_client: None,
}
}
}

/// [Alluxio](https://www.alluxio.io/) services support.
#[doc = include_str!("docs.md")]
#[derive(Default)]
pub struct AlluxioBuilder {
config: AlluxioConfig,
pub(super) config: AlluxioConfig,

#[deprecated(since = "0.53.0", note = "Use `Operator::update_http_client` instead")]
http_client: Option<HttpClient>,
pub(super) http_client: Option<HttpClient>,
}

impl Debug for AlluxioBuilder {
Expand Down Expand Up @@ -125,7 +114,7 @@ impl Builder for AlluxioBuilder {
core: Arc::new(AlluxioCore {
info: {
let am = AccessorInfo::default();
am.set_scheme(DEFAULT_SCHEME)
am.set_scheme(ALLUXIO_SCHEME)
.set_root(&root)
.set_native_capability(Capability {
stat: true,
Expand Down
13 changes: 13 additions & 0 deletions core/src/services/alluxio/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use std::fmt::Debug;
use std::fmt::Formatter;

use super::backend::AlluxioBuilder;
use serde::Deserialize;
use serde::Serialize;

Expand Down Expand Up @@ -48,3 +49,15 @@ impl Debug for AlluxioConfig {
d.finish_non_exhaustive()
}
}

impl crate::Configurator for AlluxioConfig {
type Builder = AlluxioBuilder;

#[allow(deprecated)]
fn into_builder(self) -> Self::Builder {
AlluxioBuilder {
config: self,
http_client: None,
}
}
}
10 changes: 1 addition & 9 deletions core/src/services/alluxio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,14 @@
// under the License.

/// Default scheme for alluxio service.
#[cfg(feature = "services-alluxio")]
pub(super) const DEFAULT_SCHEME: &str = "alluxio";
#[cfg(feature = "services-alluxio")]
pub(super) const ALLUXIO_SCHEME: &str = "alluxio";
mod core;
#[cfg(feature = "services-alluxio")]
mod delete;
#[cfg(feature = "services-alluxio")]
mod error;
#[cfg(feature = "services-alluxio")]
mod lister;
#[cfg(feature = "services-alluxio")]
mod writer;

#[cfg(feature = "services-alluxio")]
mod backend;
#[cfg(feature = "services-alluxio")]
pub use backend::AlluxioBuilder as Alluxio;

mod config;
Expand Down
63 changes: 2 additions & 61 deletions core/src/services/azblob/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ use super::writer::AzblobWriter;
use super::writer::AzblobWriters;
use crate::raw::*;
use crate::services::AzblobConfig;
use crate::types::OperatorUri;
use crate::*;
const AZBLOB_BATCH_LIMIT: usize = 256;

Expand All @@ -57,40 +56,13 @@ impl From<AzureStorageConfig> for AzblobConfig {
}
}

impl Configurator for AzblobConfig {
type Builder = AzblobBuilder;

fn from_uri(uri: &OperatorUri) -> Result<Self> {
let mut map = uri.options().clone();

if let Some(container) = uri.name() {
map.insert("container".to_string(), container.to_string());
}

if let Some(root) = uri.root() {
map.insert("root".to_string(), root.to_string());
}

Self::from_iter(map)
}

#[allow(deprecated)]
fn into_builder(self) -> Self::Builder {
AzblobBuilder {
config: self,

http_client: None,
}
}
}

#[doc = include_str!("docs.md")]
#[derive(Default, Clone)]
pub struct AzblobBuilder {
config: AzblobConfig,
pub(super) config: AzblobConfig,

#[deprecated(since = "0.53.0", note = "Use `Operator::update_http_client` instead")]
http_client: Option<HttpClient>,
pub(super) http_client: Option<HttpClient>,
}

impl Debug for AzblobBuilder {
Expand Down Expand Up @@ -607,34 +579,3 @@ impl Access for AzblobBackend {
)))
}
}

#[cfg(test)]
mod tests {
use super::*;
use crate::Configurator;
use crate::types::OperatorUri;

#[test]
fn from_uri_with_host_container() {
let uri = OperatorUri::new(
"azblob://my-container/path/to/root".parse().unwrap(),
Vec::<(String, String)>::new(),
)
.unwrap();
let cfg = AzblobConfig::from_uri(&uri).unwrap();
assert_eq!(cfg.container, "my-container");
assert_eq!(cfg.root.as_deref(), Some("path/to/root"));
}

#[test]
fn from_uri_with_path_container() {
let uri = OperatorUri::new(
"azblob://my-container/nested/root".parse().unwrap(),
Vec::<(String, String)>::new(),
)
.unwrap();
let cfg = AzblobConfig::from_uri(&uri).unwrap();
assert_eq!(cfg.container, "my-container");
assert_eq!(cfg.root.as_deref(), Some("nested/root"));
}
}
Loading
Loading