Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsql: Switch to hyper for local offline #1825

Merged
merged 1 commit into from
Nov 18, 2024
Merged

Conversation

LucioFranco
Copy link
Contributor

This commit switches our usage of reqwest to hyper. In the future, this will allow us to pass in configuration for the connector to support both custom TLS implementations (aka using the system tls impl over rustls) and connecting to the sqld network simulation for future testing. This also removes the extra dependency on reqwest which is not needed since we already pull in the dependencies needed to implement the new protocol for local offline writes.

@LucioFranco LucioFranco changed the title libsql: Switch to hyper for local offline sync-switch-hyper libsql: Switch to hyper for local offline Nov 18, 2024
This commit switches our usage of reqwest to hyper. In the future, this
will allow us to pass in configuration for the connector to support both
custom TLS implementations (aka using the system tls impl over rustls)
and connecting to the sqld network simulation for future testing. This
also removes the extra dependency on reqwest which is not needed since
we already pull in the dependencies needed to implement the new
protocol for local offline writes.
@LucioFranco LucioFranco force-pushed the lucio/sync-switch-hyper branch from b190f80 to c8f74e4 Compare November 18, 2024 17:55
libsql/Cargo.toml Show resolved Hide resolved
// TODO(lucio): convert this to use bytes to make this clone cheap, it should be
// to possible use BytesMut when reading frames from the WAL and efficiently use Bytes
// from that.
let req = req.body(frame.clone().into()).expect("valid body");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

body wouldn't accept frame.to_vec()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found to_vec to not be clear since, its already a Vec<u8> so this instead reads copy the frame and convert it into the type accepted by body (which in this case is hyper::Body). This should still compile to the same thing.

@LucioFranco LucioFranco added this pull request to the merge queue Nov 18, 2024
Merged via the queue into main with commit 265bd83 Nov 18, 2024
18 checks passed
@LucioFranco LucioFranco deleted the lucio/sync-switch-hyper branch November 18, 2024 18:40
penberg added a commit that referenced this pull request Nov 19, 2024
…-hyper"

This reverts commit 265bd83, reversing
changes made to 909b8af because it breaks the example app:

```
thread 'main' panicked at /Users/penberg/src/tursodatabase/libsql/libsql/src/local/database.rs:502:49:
called `Result::unwrap()` on an `Err` value: hyper::Error(Connect, "invalid URL, scheme is not http")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants