Skip to content

Commit 67cdc1d

Browse files
committed
feat(gvfs): support gvfs
1 parent 9a885fb commit 67cdc1d

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

WORKSPACE

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -880,23 +880,42 @@ http_archive(
880880
)
881881

882882
# Needed for llvm_toolchain and Golang
883+
# http_archive(
884+
# name = "com_grail_bazel_toolchain",
885+
# sha256 = "9e6065ded4b7453143e1586d6819729a63cd233114b72bf85ff3435367b02c90",
886+
# strip_prefix = "bazel-toolchain-edd07e96a2ecaa131af9234d6582875d980c0ac7",
887+
# urls = [
888+
# "https://storage.googleapis.com/mirror.tensorflow.org/github.com/grailbio/bazel-toolchain/archive/edd07e96a2ecaa131af9234d6582875d980c0ac7.tar.gz",
889+
# "https://github.com/grailbio/bazel-toolchain/archive/edd07e96a2ecaa131af9234d6582875d980c0ac7.tar.gz",
890+
# ],
891+
# )
892+
893+
# load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
894+
895+
# llvm_toolchain(
896+
# name = "llvm_toolchain",
897+
# llvm_version = "9.0.0",
898+
# )
899+
883900
http_archive(
884901
name = "com_grail_bazel_toolchain",
885-
sha256 = "9e6065ded4b7453143e1586d6819729a63cd233114b72bf85ff3435367b02c90",
886-
strip_prefix = "bazel-toolchain-edd07e96a2ecaa131af9234d6582875d980c0ac7",
887-
urls = [
888-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/grailbio/bazel-toolchain/archive/edd07e96a2ecaa131af9234d6582875d980c0ac7.tar.gz",
889-
"https://github.com/grailbio/bazel-toolchain/archive/edd07e96a2ecaa131af9234d6582875d980c0ac7.tar.gz",
890-
],
902+
urls = ["https://github.com/bazel-contrib/toolchains_llvm/archive/refs/tags/0.9.tar.gz"],
903+
sha256 = "b2d168315dd0785f170b2b306b86e577c36e812b8f8b05568f9403141f2c24dd",
904+
strip_prefix = "toolchains_llvm-0.9",
891905
)
892906

893-
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
907+
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
908+
909+
bazel_toolchain_dependencies()
894910

911+
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
895912
llvm_toolchain(
896913
name = "llvm_toolchain",
897-
llvm_version = "9.0.0",
914+
llvm_version = "0.9.0",
898915
)
899916

917+
918+
900919
# Golang related ruls, consider removal after switching to C++/C client for prometheus
901920
http_archive(
902921
name = "io_bazel_rules_go",

tensorflow_io/core/filesystems/filesystem_plugins.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ limitations under the License.
2929
TFIO_PLUGIN_EXPORT void TF_InitPlugin(TF_FilesystemPluginInfo* info) {
3030
info->plugin_memory_allocate = tensorflow::io::plugin_memory_allocate;
3131
info->plugin_memory_free = tensorflow::io::plugin_memory_free;
32-
info->num_schemes = 7;
32+
info->num_schemes = 8;
3333
info->ops = static_cast<TF_FilesystemPluginOps*>(
3434
tensorflow::io::plugin_memory_allocate(info->num_schemes *
3535
sizeof(info->ops[0])));
@@ -40,4 +40,5 @@ TFIO_PLUGIN_EXPORT void TF_InitPlugin(TF_FilesystemPluginInfo* info) {
4040
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[4], "hdfs");
4141
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[5], "viewfs");
4242
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[6], "har");
43+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[7], "gvfs");
4344
}

tensorflow_io/core/filesystems/hdfs/hadoop_filesystem.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,11 @@ hdfsFS Connect(tf_hdfs_filesystem::HadoopFileSystemImplementation* hadoop_file,
541541
std::string path_har = path;
542542
SplitArchiveNameAndPath(&path_har, &namenode, status);
543543
if (TF_GetCode(status) != TF_OK) return nullptr;
544+
} else if (scheme == "gvfs") {
545+
std::string dfsPath = path;
546+
size_t pos = dfsPath.find(hdfs_path);
547+
dfsPath.replace(pos, dfsPath.length(), "");
548+
namenode = dfsPath + "/";
544549
} else {
545550
if (namenode.empty()) {
546551
namenode = "default";

0 commit comments

Comments
 (0)