Xuanwo commented on code in PR #3933:
URL:
https://github.com/apache/incubator-opendal/pull/3933#discussion_r1444226873
##########
core/Cargo.toml:
##########
@@ -195,8 +195,11 @@ services-vercel-artifacts = []
services-wasabi = []
services-webdav = []
services-webhdfs = []
+
+services-native-hdfs = ["dep:hdfs-native"]
Review Comment:
I'm somewhat hesitant about the names of these services. Maybe use the crate
name `services-hdfs-native`?
##########
core/Cargo.toml:
##########
@@ -306,6 +309,7 @@ tokio = { version = "1.27", features = ["sync"] }
tokio-postgres = { version = "0.7.8", optional = true }
tracing = { version = "0.1", optional = true }
uuid = { version = "1", features = ["serde", "v4"] }
+hdfs-native = { version = "0.5.0", optional = true }
Review Comment:
Please use the latest version `0.6.0` instead.
##########
core/src/services/native_hdfs/backend.rs:
##########
@@ -0,0 +1,228 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::{Debug, Formatter};
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use log::debug;
+use serde::Deserialize;
+use uuid::Uuid;
+
+use super::lister::NativeHdfsLister;
+use super::reader::NativeHdfsReader;
+use super::writer::NativeHdfsWriter;
+use crate::raw::*;
+use crate::*;
+
+/// [Hadoop Distributed File System (HDFS™)](https://hadoop.apache.org/)
support.
+/// Using [Native Rust HDFS client](https://github.com/Kimahriman/hdfs-native).
+
+/// Config for NativeHdfs services support.
+#[derive(Default, Deserialize, Clone)]
+#[serde(default)]
+#[non_exhaustive]
+pub struct NativeHdfsConfig {
+ /// work dir of this backend
+ pub root: Option<String>,
+ /// name node of this backend
+ pub name_node: Option<String>,
Review Comment:
`hdfs_native` uses `url` in public API, let's keep the same with it.
##########
core/Cargo.toml:
##########
@@ -195,8 +195,11 @@ services-vercel-artifacts = []
services-wasabi = []
services-webdav = []
services-webhdfs = []
+
Review Comment:
remove this line.
##########
core/src/services/native_hdfs/docs.md:
##########
Review Comment:
Please include a title at the very least.
##########
core/Cargo.toml:
##########
@@ -195,8 +195,11 @@ services-vercel-artifacts = []
services-wasabi = []
services-webdav = []
services-webhdfs = []
+
+services-native-hdfs = ["dep:hdfs-native"]
services-yandex-disk = []
+
Review Comment:
Please don't introduce unrelated changes.
##########
core/src/services/native_hdfs/lister.rs:
##########
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::raw::oio;
+use crate::raw::oio::Entry;
+use std::sync::Arc;
+use std::task::{Context, Poll};
+
+pub struct NativeHdfsLister {
+ root: String,
+ client: Arc<hdfs_native::Client>,
+}
+
+impl NativeHdfsLister {
+ pub fn new(path: String, client: Arc<hdfs_native::Client>) -> Self {
+ NativeHdfsLister { root: path, client }
+ }
+}
+
+impl oio::List for NativeHdfsLister {
+ fn poll_next(&mut self, cx: &mut Context<'_>) ->
Poll<crate::Result<Option<Entry>>> {
Review Comment:
Please add `use crate::*` and use `Result` directly here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]