Skip to content

Commit

Permalink
[#5877] feat (gvfs-fuse): Implement a common filesystem layer (#5878)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

Implement a common filesystem layer to handle manage file ids, file name
mappings, and file relationships. and delegate filesystem APIs to
PathFilesystem.

### Why are the changes needed?

Fix: #5877

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Uts
  • Loading branch information
diqiu50 authored Dec 24, 2024
1 parent b238873 commit 8275465
Show file tree
Hide file tree
Showing 12 changed files with 969 additions and 63 deletions.
1 change: 0 additions & 1 deletion clients/filesystem-fuse/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@
# under the License.

[build]
target-dir = "build"
rustflags = ["-Adead_code", "-Aclippy::redundant-field-names"]
6 changes: 4 additions & 2 deletions clients/filesystem-fuse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ name = "gvfs-fuse"
path = "src/main.rs"

[lib]
name="gvfs_fuse"
name = "gvfs_fuse"

[dependencies]
async-trait = "0.1"
bytes = "1.6.0"
futures-util = "0.3.30"
dashmap = "6.1.0"
fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] }
futures-util = "0.3.30"
libc = "0.2.168"
log = "0.4.22"
tokio = { version = "1.38.0", features = ["full"] }
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
Expand Down
69 changes: 69 additions & 0 deletions clients/filesystem-fuse/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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.

.EXPORT_ALL_VARIABLES:

.PHONY: build
build:
cargo build --all-features --workspace

fmt:
cargo fmt --all

cargo-sort: install-cargo-sort
cargo sort -w

fix-toml: install-taplo-cli
taplo fmt

check-fmt:
cargo fmt --all -- --check

check-clippy:
cargo clippy --all-targets --all-features --workspace -- -D warnings

install-cargo-sort:
cargo install [email protected]

check-cargo-sort: install-cargo-sort
cargo sort -c

install-cargo-machete:
cargo install cargo-machete

cargo-machete: install-cargo-machete
cargo machete

install-taplo-cli:
cargo install [email protected]

check-toml: install-taplo-cli
taplo check

check: check-fmt check-clippy check-cargo-sort check-toml cargo-machete

doc-test:
cargo test --no-fail-fast --doc --all-features --workspace

unit-test: doc-test
cargo test --no-fail-fast --lib --all-features --workspace

test: doc-test
cargo test --no-fail-fast --all-targets --all-features --workspace

clean:
cargo clean
36 changes: 16 additions & 20 deletions clients/filesystem-fuse/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import org.gradle.api.tasks.Exec

val checkRustEnvironment by tasks.registering(Exec::class) {
description = "Check if Rust environment."
group = "verification"
commandLine("bash", "-c", "cargo --version")
standardOutput = System.out
errorOutput = System.err
Expand All @@ -30,36 +28,30 @@ val checkRustEnvironment by tasks.registering(Exec::class) {

val buildRustProject by tasks.registering(Exec::class) {
dependsOn(checkRustEnvironment)
description = "Compile the Rust project"
workingDir = file("$projectDir")
commandLine("bash", "-c", "cargo build --release")
commandLine("bash", "-c", "make build")
}

val checkRustProject by tasks.registering(Exec::class) {
dependsOn(checkRustEnvironment)
description = "Check the Rust project"
workingDir = file("$projectDir")

commandLine(
"bash",
"-c",
"""
set -e
echo "Checking the code format"
cargo fmt --all -- --check
echo "Running clippy"
cargo clippy --all-targets --all-features --workspace -- -D warnings
""".trimIndent()
)
commandLine("bash", "-c", "make check")
}

val testRustProject by tasks.registering(Exec::class) {
dependsOn(checkRustEnvironment)
description = "Run tests in the Rust project"
group = "verification"
workingDir = file("$projectDir")
commandLine("bash", "-c", "cargo test --release")
commandLine("bash", "-c", "make test")

standardOutput = System.out
errorOutput = System.err
}

val cleanRustProject by tasks.registering(Exec::class) {
dependsOn(checkRustEnvironment)
workingDir = file("$projectDir")
commandLine("bash", "-c", "make clean")

standardOutput = System.out
errorOutput = System.err
Expand All @@ -85,3 +77,7 @@ tasks.named("check") {
tasks.named("test") {
dependsOn(testRustProject)
}

tasks.named("clean") {
dependsOn(cleanRustProject)
}
Loading

0 comments on commit 8275465

Please sign in to comment.