diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f11c4ce..045f8a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,4 +165,4 @@ jobs: - name: Run wasm-pack test on fusion-parquet run: | export PATH=$PATH:/tmp/chrome/chrome-linux64/:/tmp/chrome/chromedriver-linux64/ - wasm-pack test --chrome --headless fusio-parquet --features opfs + wasm-pack test --chrome --headless fusio-parquet --features wasm diff --git a/examples/opfs/Cargo.toml b/examples/opfs/Cargo.toml index 913dcd6..4b8580b 100644 --- a/examples/opfs/Cargo.toml +++ b/examples/opfs/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib", "rlib"] arrow = "53" fusio = { path = "../../fusio", features = ["opfs"] } fusio-dispatch = { path = "../../fusio-dispatch", features = ["opfs"] } -fusio-parquet = { path = "../../fusio-parquet", features = ["opfs"] } +fusio-parquet = { path = "../../fusio-parquet", features = ["wasm"] } futures = { version = "0.3" } parquet = { version = "53", default-features = false, features = [ "arrow", diff --git a/fusio-parquet/Cargo.toml b/fusio-parquet/Cargo.toml index 5b2c903..5f66a13 100644 --- a/fusio-parquet/Cargo.toml +++ b/fusio-parquet/Cargo.toml @@ -8,7 +8,7 @@ version = "0.2.2" [features] default = [] -opfs = ["fusio/opfs"] +wasm = ["fusio/opfs"] tokio = ["fusio/tokio"] [dependencies] diff --git a/fusio-parquet/src/reader.rs b/fusio-parquet/src/reader.rs index a6e598c..a1a3602 100644 --- a/fusio-parquet/src/reader.rs +++ b/fusio-parquet/src/reader.rs @@ -16,9 +16,9 @@ use parquet::{ const PREFETCH_FOOTER_SIZE: usize = 512 * 1024; pub struct AsyncReader { - #[cfg(feature = "opfs")] + #[cfg(feature = "wasm")] inner: Arc>>, - #[cfg(not(feature = "opfs"))] + #[cfg(not(feature = "wasm"))] inner: Box, content_length: u64, // The prefetch size for fetching file footer. @@ -34,7 +34,7 @@ fn set_prefetch_footer_size(footer_size: usize, content_size: u64) -> usize { impl AsyncReader { pub async fn new(reader: Box, content_length: u64) -> Result { - #[cfg(feature = "opfs")] + #[cfg(feature = "wasm")] #[allow(clippy::arc_with_non_send_sync)] let reader = Arc::new(futures::lock::Mutex::new(reader)); Ok(Self { @@ -57,7 +57,7 @@ impl AsyncFileReader for AsyncReader { buf.resize(len, 0); cfg_if::cfg_if! { - if #[cfg(all(feature = "opfs", target_arch = "wasm32"))] { + if #[cfg(all(feature = "wasm", target_arch = "wasm32"))] { let (sender, receiver) = futures::channel::oneshot::channel::>(); let reader = self.inner.clone(); @@ -97,7 +97,7 @@ impl AsyncFileReader for AsyncReader { let content_length = self.content_length; cfg_if::cfg_if! { - if #[cfg(all(feature = "opfs", target_arch = "wasm32"))] { + if #[cfg(all(feature = "wasm", target_arch = "wasm32"))] { let mut buf = BytesMut::with_capacity(footer_size); buf.resize(footer_size, 0); let (sender, receiver) = futures::channel::oneshot::channel::, ParquetError>>(); diff --git a/fusio-parquet/src/writer.rs b/fusio-parquet/src/writer.rs index c77916a..0b60f12 100644 --- a/fusio-parquet/src/writer.rs +++ b/fusio-parquet/src/writer.rs @@ -5,17 +5,17 @@ use futures::future::BoxFuture; use parquet::{arrow::async_writer::AsyncFileWriter, errors::ParquetError}; pub struct AsyncWriter { - #[cfg(feature = "opfs")] + #[cfg(feature = "wasm")] #[allow(clippy::arc_with_non_send_sync)] inner: Option>>>, - #[cfg(not(feature = "opfs"))] + #[cfg(not(feature = "wasm"))] inner: Option>, } unsafe impl Send for AsyncWriter {} impl AsyncWriter { pub fn new(writer: Box) -> Self { - #[cfg(feature = "opfs")] + #[cfg(feature = "wasm")] #[allow(clippy::arc_with_non_send_sync)] let writer = std::sync::Arc::new(futures::lock::Mutex::new(writer)); { @@ -29,7 +29,7 @@ impl AsyncWriter { impl AsyncFileWriter for AsyncWriter { fn write(&mut self, bs: Bytes) -> BoxFuture<'_, parquet::errors::Result<()>> { cfg_if::cfg_if! { - if #[cfg(all(feature = "opfs", target_arch = "wasm32"))] { + if #[cfg(all(feature = "wasm", target_arch = "wasm32"))] { match self.inner.as_mut() { Some(writer) => { let (sender, receiver) = futures::channel::oneshot::channel::>(); @@ -70,7 +70,7 @@ impl AsyncFileWriter for AsyncWriter { fn complete(&mut self) -> BoxFuture<'_, parquet::errors::Result<()>> { cfg_if::cfg_if! { - if #[cfg(all(feature = "opfs", target_arch = "wasm32"))] { + if #[cfg(all(feature = "wasm", target_arch = "wasm32"))] { match self.inner.take() { Some(writer) => { let (sender, receiver) = futures::channel::oneshot::channel::>(); diff --git a/fusio-parquet/tests/opfs.rs b/fusio-parquet/tests/wasm.rs similarity index 99% rename from fusio-parquet/tests/opfs.rs rename to fusio-parquet/tests/wasm.rs index 6a18d6b..4dbe12a 100644 --- a/fusio-parquet/tests/opfs.rs +++ b/fusio-parquet/tests/wasm.rs @@ -1,5 +1,5 @@ #[cfg(test)] -#[cfg(all(feature = "opfs", target_arch = "wasm32"))] +#[cfg(all(feature = "wasm", target_arch = "wasm32"))] pub(crate) mod tests { wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);