Skip to content

Commit 77c3931

Browse files
committed
object_store: Add enabled-by-default "fs" feature
1 parent 22bc772 commit 77c3931

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

object_store/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ percent-encoding = "2.1"
4141
snafu = { version = "0.8", default-features = false, features = ["std", "rust_1_61"] }
4242
tracing = { version = "0.1" }
4343
url = "2.2"
44-
walkdir = "2"
44+
walkdir = { version = "2", optional = true }
4545

4646
# Cloud storage support
4747
base64 = { version = "0.22", default-features = false, features = ["std"], optional = true }
@@ -60,8 +60,10 @@ md-5 = { version = "0.10.6", default-features = false, optional = true }
6060
nix = { version = "0.29.0", features = ["fs"] }
6161

6262
[features]
63+
default = ["fs"]
6364
cloud = ["serde", "serde_json", "quick-xml", "hyper", "reqwest", "reqwest/json", "reqwest/stream", "chrono/serde", "base64", "rand", "ring"]
6465
azure = ["cloud"]
66+
fs = ["walkdir"]
6567
gcp = ["cloud", "rustls-pemfile"]
6668
aws = ["cloud", "md-5"]
6769
http = ["cloud"]

object_store/src/lib.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
//!
7171
//! Feature flags are used to enable support for other implementations:
7272
//!
73+
#![cfg_attr(
74+
feature = "fs",
75+
doc = "* Local filesystem: [`LocalFileSystem`](local::LocalFileSystem)"
76+
)]
7377
#![cfg_attr(
7478
feature = "gcp",
7579
doc = "* [`gcp`]: [Google Cloud Storage](https://cloud.google.com/storage/) support. See [`GoogleCloudStorageBuilder`](gcp::GoogleCloudStorageBuilder)"
@@ -513,7 +517,7 @@ pub mod gcp;
513517
#[cfg(feature = "http")]
514518
pub mod http;
515519
pub mod limit;
516-
#[cfg(not(target_arch = "wasm32"))]
520+
#[cfg(all(feature = "fs", not(target_arch = "wasm32")))]
517521
pub mod local;
518522
pub mod memory;
519523
pub mod path;
@@ -1047,7 +1051,7 @@ impl GetResult {
10471051
pub async fn bytes(self) -> Result<Bytes> {
10481052
let len = self.range.end - self.range.start;
10491053
match self.payload {
1050-
#[cfg(not(target_arch = "wasm32"))]
1054+
#[cfg(all(feature = "fs", not(target_arch = "wasm32")))]
10511055
GetResultPayload::File(mut file, path) => {
10521056
maybe_spawn_blocking(move || {
10531057
file.seek(SeekFrom::Start(self.range.start as _))
@@ -1087,7 +1091,7 @@ impl GetResult {
10871091
/// no additional complexity or overheads
10881092
pub fn into_stream(self) -> BoxStream<'static, Result<Bytes>> {
10891093
match self.payload {
1090-
#[cfg(not(target_arch = "wasm32"))]
1094+
#[cfg(all(feature = "fs", not(target_arch = "wasm32")))]
10911095
GetResultPayload::File(file, path) => {
10921096
const CHUNK_SIZE: usize = 8 * 1024;
10931097
local::chunked_stream(file, path, self.range, CHUNK_SIZE)

0 commit comments

Comments
 (0)