Skip to content

Commit 9144efe

Browse files
committed
i like old name better
1 parent bb93398 commit 9144efe

File tree

3 files changed

+34
-30
lines changed

3 files changed

+34
-30
lines changed

crates/iceberg/src/io/file_io.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::sync::Arc;
2323
use bytes::Bytes;
2424
use url::Url;
2525

26-
use super::storage::{OpenDal, Storage};
26+
use super::storage::{OpenDalStorage, Storage};
2727
use crate::{Error, ErrorKind, Result};
2828

2929
/// FileIO implementation, used to manipulate files in underlying storage.
@@ -47,7 +47,7 @@ use crate::{Error, ErrorKind, Result};
4747
pub struct FileIO {
4848
builder: FileIOBuilder,
4949

50-
inner: Arc<OpenDal>,
50+
inner: Arc<OpenDalStorage>,
5151
}
5252

5353
impl FileIO {
@@ -239,7 +239,7 @@ impl FileIOBuilder {
239239

240240
/// Builds [`FileIO`].
241241
pub fn build(self) -> Result<FileIO> {
242-
let storage = OpenDal::build(self.clone())?;
242+
let storage = OpenDalStorage::build(self.clone())?;
243243
Ok(FileIO {
244244
builder: self,
245245
inner: Arc::new(storage),

crates/iceberg/src/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ mod storage;
7272

7373
pub use config::*;
7474
pub use file_io::*;
75-
pub use storage::{OpenDal, OpenDalFactory, Storage, StorageConfig, StorageFactory};
75+
pub use storage::{OpenDalStorage, OpenDalStorageFactory, Storage, StorageConfig, StorageFactory};
7676
pub(crate) mod object_cache;
7777

7878
#[cfg(feature = "storage-azdls")]

crates/iceberg/src/io/storage.rs

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ pub trait StorageFactory: Debug + Send + Sync {
159159

160160
/// OpenDAL-based storage factory.
161161
///
162-
/// Maps scheme to the corresponding OpenDal storage variant.
162+
/// Maps scheme to the corresponding OpenDalStorage storage variant.
163163
///
164-
/// TODO this is currently not used, we still use OpenDal::build() for now
164+
/// TODO this is currently not used, we still use OpenDalStorage::build() for now
165165
#[derive(Clone, Debug, Serialize, Deserialize)]
166-
pub enum OpenDalFactory {
166+
pub enum OpenDalStorageFactory {
167167
/// Memory storage factory.
168168
#[cfg(feature = "storage-memory")]
169169
Memory,
@@ -191,36 +191,40 @@ pub enum OpenDalFactory {
191191
},
192192
}
193193

194-
#[typetag::serde(name = "OpenDalFactory")]
195-
impl StorageFactory for OpenDalFactory {
194+
#[typetag::serde(name = "OpenDalStorageFactory")]
195+
impl StorageFactory for OpenDalStorageFactory {
196196
#[allow(unused_variables)]
197197
fn build(&self, config: &StorageConfig) -> Result<Arc<dyn Storage>> {
198198
match self {
199199
#[cfg(feature = "storage-memory")]
200-
OpenDalFactory::Memory => Ok(Arc::new(OpenDal::Memory(super::memory_config_build()?))),
200+
OpenDalStorageFactory::Memory => {
201+
Ok(Arc::new(OpenDalStorage::Memory(super::memory_config_build()?)))
202+
}
201203
#[cfg(feature = "storage-fs")]
202-
OpenDalFactory::Fs => Ok(Arc::new(OpenDal::LocalFs)),
204+
OpenDalStorageFactory::Fs => Ok(Arc::new(OpenDalStorage::LocalFs)),
203205
#[cfg(feature = "storage-s3")]
204-
OpenDalFactory::S3 {
206+
OpenDalStorageFactory::S3 {
205207
customized_credential_load,
206-
} => Ok(Arc::new(OpenDal::S3 {
208+
} => Ok(Arc::new(OpenDalStorage::S3 {
207209
configured_scheme: "s3".to_string(),
208210
config: super::s3_config_parse(config.props().clone())?.into(),
209211
customized_credential_load: customized_credential_load.clone(),
210212
})),
211213
#[cfg(feature = "storage-gcs")]
212-
OpenDalFactory::Gcs => Ok(Arc::new(OpenDal::Gcs {
214+
OpenDalStorageFactory::Gcs => Ok(Arc::new(OpenDalStorage::Gcs {
213215
config: super::gcs_config_parse(config.props().clone())?.into(),
214216
})),
215217
#[cfg(feature = "storage-oss")]
216-
OpenDalFactory::Oss => Ok(Arc::new(OpenDal::Oss {
218+
OpenDalStorageFactory::Oss => Ok(Arc::new(OpenDalStorage::Oss {
217219
config: super::oss_config_parse(config.props().clone())?.into(),
218220
})),
219221
#[cfg(feature = "storage-azdls")]
220-
OpenDalFactory::Azdls { configured_scheme } => Ok(Arc::new(OpenDal::Azdls {
221-
configured_scheme: configured_scheme.clone(),
222-
config: super::azdls_config_parse(config.props().clone())?.into(),
223-
})),
222+
OpenDalStorageFactory::Azdls { configured_scheme } => {
223+
Ok(Arc::new(OpenDalStorage::Azdls {
224+
configured_scheme: configured_scheme.clone(),
225+
config: super::azdls_config_parse(config.props().clone())?.into(),
226+
}))
227+
}
224228
#[cfg(all(
225229
not(feature = "storage-memory"),
226230
not(feature = "storage-fs"),
@@ -245,7 +249,7 @@ fn default_memory_operator() -> Operator {
245249

246250
/// OpenDAL-based storage implementation.
247251
#[derive(Clone, Debug, Serialize, Deserialize)]
248-
pub enum OpenDal {
252+
pub enum OpenDalStorage {
249253
/// Memory storage variant.
250254
#[cfg(feature = "storage-memory")]
251255
Memory(#[serde(skip, default = "self::default_memory_operator")] Operator),
@@ -292,10 +296,10 @@ pub enum OpenDal {
292296
},
293297
}
294298

295-
impl OpenDal {
299+
impl OpenDalStorage {
296300
/// Convert iceberg config to opendal config.
297301
///
298-
/// TODO Switch to use OpenDalFactory::build()
302+
/// TODO Switch to use OpenDalStorageFactory::build()
299303
pub(crate) fn build(file_io_builder: FileIOBuilder) -> Result<Self> {
300304
let (scheme_str, props, extensions) = file_io_builder.into_parts();
301305
let _ = (&props, &extensions);
@@ -358,15 +362,15 @@ impl OpenDal {
358362
let path = path.as_ref();
359363
let (operator, relative_path): (Operator, &str) = match self {
360364
#[cfg(feature = "storage-memory")]
361-
OpenDal::Memory(op) => {
365+
OpenDalStorage::Memory(op) => {
362366
if let Some(stripped) = path.strip_prefix("memory:/") {
363367
(op.clone(), stripped)
364368
} else {
365369
(op.clone(), &path[1..])
366370
}
367371
}
368372
#[cfg(feature = "storage-fs")]
369-
OpenDal::LocalFs => {
373+
OpenDalStorage::LocalFs => {
370374
let op = super::fs_config_build()?;
371375
if let Some(stripped) = path.strip_prefix("file:/") {
372376
(op, stripped)
@@ -375,7 +379,7 @@ impl OpenDal {
375379
}
376380
}
377381
#[cfg(feature = "storage-s3")]
378-
OpenDal::S3 {
382+
OpenDalStorage::S3 {
379383
configured_scheme,
380384
config,
381385
customized_credential_load,
@@ -395,7 +399,7 @@ impl OpenDal {
395399
}
396400
}
397401
#[cfg(feature = "storage-gcs")]
398-
OpenDal::Gcs { config } => {
402+
OpenDalStorage::Gcs { config } => {
399403
let operator = super::gcs_config_build(config, path)?;
400404
let prefix = format!("gs://{}/", operator.info().name());
401405
if path.starts_with(&prefix) {
@@ -408,7 +412,7 @@ impl OpenDal {
408412
}
409413
}
410414
#[cfg(feature = "storage-oss")]
411-
OpenDal::Oss { config } => {
415+
OpenDalStorage::Oss { config } => {
412416
let op = super::oss_config_build(config, path)?;
413417
let prefix = format!("oss://{}/", op.info().name());
414418
if path.starts_with(&prefix) {
@@ -421,7 +425,7 @@ impl OpenDal {
421425
}
422426
}
423427
#[cfg(feature = "storage-azdls")]
424-
OpenDal::Azdls {
428+
OpenDalStorage::Azdls {
425429
configured_scheme,
426430
config,
427431
} => super::azdls_create_operator(path, config, configured_scheme)?,
@@ -460,9 +464,9 @@ impl OpenDal {
460464
}
461465
}
462466

463-
#[typetag::serde(name = "OpenDal")]
467+
#[typetag::serde(name = "OpenDalStorage")]
464468
#[async_trait]
465-
impl Storage for OpenDal {
469+
impl Storage for OpenDalStorage {
466470
async fn exists(&self, path: &str) -> Result<bool> {
467471
let (op, relative_path) = self.create_operator(&path)?;
468472
Ok(op.exists(relative_path).await?)

0 commit comments

Comments
 (0)