Skip to content

Commit

Permalink
Merge pull request #586 from tursodatabase/lucio/fix-cf-sender
Browse files Browse the repository at this point in the history
libsql: make cf sender public
  • Loading branch information
LucioFranco committed Nov 7, 2023
2 parents 94a388d + fd0c479 commit 3b2da5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 6 additions & 2 deletions libsql/src/wasm/cloudflare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ use std::future::Future;
use std::pin::Pin;
use worker::wasm_bindgen::JsValue;

#[derive(Default, Debug, Copy, Clone)]
pub(super) struct CloudflareSender(());
#[derive(Debug, Copy, Clone)]
pub struct CloudflareSender(());

impl CloudflareSender {
pub(crate) fn new() -> Self {
CloudflareSender(())
}

async fn send(url: String, auth: String, body: String) -> Result<ServerMsg> {
use worker::*;

Expand Down
5 changes: 2 additions & 3 deletions libsql/src/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ use crate::{

cfg_cloudflare! {
mod cloudflare;
pub use cloudflare::CloudflareSender;
}

#[derive(Debug, Clone)]
Expand All @@ -44,12 +45,10 @@ pub struct Connection<T> {
}

cfg_cloudflare! {
use cloudflare::CloudflareSender;

impl Connection<CloudflareSender> {
pub fn open_cloudflare_worker(url: impl Into<String>, auth_token: impl Into<String>) -> Self {
Connection {
conn: HttpConnection::new(url.into(), auth_token.into(), CloudflareSender::default()),
conn: HttpConnection::new(url.into(), auth_token.into(), CloudflareSender::new()),
}
}
}
Expand Down

0 comments on commit 3b2da5a

Please sign in to comment.