This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new cd323f87d feat: make services-gdrive compile for wasm target (#3808)
cd323f87d is described below
commit cd323f87d9ab22ac1af1718ec342c3fa63838b3e
Author: Flash <[email protected]>
AuthorDate: Sat Dec 23 18:51:10 2023 +0800
feat: make services-gdrive compile for wasm target (#3808)
---
.github/workflows/ci.yml | 3 ++-
core/src/services/gdrive/backend.rs | 3 ++-
core/src/services/gdrive/lister.rs | 3 ++-
core/src/services/gdrive/writer.rs | 3 ++-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 091893e52..6bd9a3b84 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -293,7 +293,7 @@ jobs:
)
cargo build --features "${FEATURES[*]}"
- # We only support s3 services for now, but we will extend wasm support for
other services.
+ # We only support some services(see `available_services` below) for now, but
we will extend wasm support for other services.
build_under_wasm:
runs-on: ubuntu-latest
steps:
@@ -306,6 +306,7 @@ jobs:
run: |
available_services=(
services-azblob
+ services-gdrive
services-s3
)
IFS=","
diff --git a/core/src/services/gdrive/backend.rs
b/core/src/services/gdrive/backend.rs
index fd83d96fa..3e88e912c 100644
--- a/core/src/services/gdrive/backend.rs
+++ b/core/src/services/gdrive/backend.rs
@@ -39,7 +39,8 @@ pub struct GdriveBackend {
pub core: Arc<GdriveCore>,
}
-#[async_trait]
+#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
+#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl Accessor for GdriveBackend {
type Reader = IncomingAsyncBody;
type BlockingReader = ();
diff --git a/core/src/services/gdrive/lister.rs
b/core/src/services/gdrive/lister.rs
index b8cf78a8e..9da239035 100644
--- a/core/src/services/gdrive/lister.rs
+++ b/core/src/services/gdrive/lister.rs
@@ -37,7 +37,8 @@ impl GdriveLister {
}
}
-#[async_trait]
+#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
+#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl oio::PageList for GdriveLister {
async fn next_page(&self, ctx: &mut oio::PageContext) -> Result<()> {
let file_id = self.core.get_file_id_by_path(&self.path).await?;
diff --git a/core/src/services/gdrive/writer.rs
b/core/src/services/gdrive/writer.rs
index 445ecb36f..f902ed255 100644
--- a/core/src/services/gdrive/writer.rs
+++ b/core/src/services/gdrive/writer.rs
@@ -87,7 +87,8 @@ impl GdriveWriter {
}
}
-#[async_trait]
+#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
+#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl oio::OneShotWrite for GdriveWriter {
async fn write_once(&self, bs: &dyn WriteBuf) -> Result<()> {
let bs = bs.bytes(bs.remaining());