Skip to content

Commit

Permalink
feat: make services-gdrive compile for wasm target (#3808)
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash authored Dec 23, 2023
1 parent 135b389 commit cd323f8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -306,6 +306,7 @@ jobs:
run: |
available_services=(
services-azblob
services-gdrive
services-s3
)
IFS=","
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/gdrive/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ();
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/gdrive/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
3 changes: 2 additions & 1 deletion core/src/services/gdrive/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit cd323f8

Please sign in to comment.