Skip to content

Commit 60d694c

Browse files
committed
WIP: Hyper 1.0 migration for libsql-server
- Updated Cargo.toml dependencies (hyper 1.0, axum 0.7, tonic 0.12, prost 0.13, rustls 0.23) - Migrated body APIs: hyper::body::to_bytes -> http_body_util::BodyExt::collect - Migrated client APIs: hyper::Client -> hyper_util::client::legacy::Client - Migrated server APIs: hyper::server::Server -> hyper_util::server::conn::auto::Builder - Fixed rustls 0.23 API changes (CertificateDer, PrivateKeyDer) - Fixed tonic 0.12 trait implementations - Fixed prost 0.13 Message trait signatures (impl Trait) - Fixed axum 0.7 middleware and body types - Note: libsql and libsql_replication compile successfully - libsql-server has remaining trait bound issues to resolve
1 parent 0c68b6b commit 60d694c

20 files changed

Lines changed: 888 additions & 612 deletions

File tree

Cargo.lock

Lines changed: 390 additions & 285 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libsql-hrana/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "Remote protocol for libSQL"
99

1010
[dependencies]
1111
serde = { version = "1.0", features = ["derive", "rc"] }
12-
prost = { version = "0.12" }
12+
prost = { version = "0.13" }
1313
base64 = { version = "0.21" }
1414
bytes = "1"
1515

libsql-hrana/src/protobuf.rs

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ use super::proto::{
1313
};
1414

1515
impl prost::Message for StreamResult {
16-
fn encode_raw<B>(&self, buf: &mut B)
16+
fn encode_raw(&self, buf: &mut impl BufMut)
1717
where
18-
B: BufMut,
1918
Self: Sized,
2019
{
2120
match self {
@@ -33,15 +32,14 @@ impl prost::Message for StreamResult {
3332
}
3433
}
3534

36-
fn merge_field<B>(
35+
fn merge_field(
3736
&mut self,
3837
_tag: u32,
3938
_wire_type: WireType,
40-
_buf: &mut B,
39+
_buf: &mut impl Buf,
4140
_ctx: DecodeContext,
4241
) -> Result<(), DecodeError>
4342
where
44-
B: Buf,
4543
Self: Sized,
4644
{
4745
panic!("StreamResult can only be encoded, not decoded")
@@ -53,9 +51,8 @@ impl prost::Message for StreamResult {
5351
}
5452

5553
impl prost::Message for StreamRequest {
56-
fn encode_raw<B>(&self, _buf: &mut B)
54+
fn encode_raw(&self, _buf: &mut impl BufMut)
5755
where
58-
B: BufMut,
5956
Self: Sized,
6057
{
6158
panic!("StreamRequest can only be decoded, not encoded")
@@ -65,15 +62,14 @@ impl prost::Message for StreamRequest {
6562
panic!("StreamRequest can only be decoded, not encoded")
6663
}
6764

68-
fn merge_field<B>(
65+
fn merge_field(
6966
&mut self,
7067
tag: u32,
7168
wire_type: WireType,
72-
buf: &mut B,
69+
buf: &mut impl Buf,
7370
ctx: DecodeContext,
7471
) -> Result<(), DecodeError>
7572
where
76-
B: Buf,
7773
Self: Sized,
7874
{
7975
macro_rules! merge {
@@ -107,9 +103,8 @@ impl prost::Message for StreamRequest {
107103
}
108104

109105
impl prost::Message for StreamResponse {
110-
fn encode_raw<B>(&self, buf: &mut B)
106+
fn encode_raw(&self, buf: &mut impl BufMut)
111107
where
112-
B: BufMut,
113108
Self: Sized,
114109
{
115110
match self {
@@ -137,15 +132,14 @@ impl prost::Message for StreamResponse {
137132
}
138133
}
139134

140-
fn merge_field<B>(
135+
fn merge_field(
141136
&mut self,
142137
_tag: u32,
143138
_wire_type: WireType,
144-
_buf: &mut B,
139+
_buf: &mut impl Buf,
145140
_ctx: DecodeContext,
146141
) -> Result<(), DecodeError>
147142
where
148-
B: Buf,
149143
Self: Sized,
150144
{
151145
panic!("StreamResponse can only be encoded, not decoded")
@@ -157,9 +151,8 @@ impl prost::Message for StreamResponse {
157151
}
158152

159153
impl prost::Message for BatchResult {
160-
fn encode_raw<B>(&self, buf: &mut B)
154+
fn encode_raw(&self, buf: &mut impl BufMut)
161155
where
162-
B: BufMut,
163156
Self: Sized,
164157
{
165158
vec_as_map::encode(1, &self.step_results, buf);
@@ -171,15 +164,14 @@ impl prost::Message for BatchResult {
171164
+ vec_as_map::encoded_len(2, &self.step_errors)
172165
}
173166

174-
fn merge_field<B>(
167+
fn merge_field(
175168
&mut self,
176169
_tag: u32,
177170
_wire_type: WireType,
178-
_buf: &mut B,
171+
_buf: &mut impl Buf,
179172
_ctx: DecodeContext,
180173
) -> Result<(), DecodeError>
181174
where
182-
B: Buf,
183175
Self: Sized,
184176
{
185177
panic!("BatchResult can only be encoded, not decoded")
@@ -192,9 +184,8 @@ impl prost::Message for BatchResult {
192184
}
193185

194186
impl prost::Message for BatchCond {
195-
fn encode_raw<B>(&self, _buf: &mut B)
187+
fn encode_raw(&self, _buf: &mut impl BufMut)
196188
where
197-
B: BufMut,
198189
Self: Sized,
199190
{
200191
panic!("BatchCond can only be decoded, not encoded")
@@ -204,15 +195,14 @@ impl prost::Message for BatchCond {
204195
panic!("BatchCond can only be decoded, not encoded")
205196
}
206197

207-
fn merge_field<B>(
198+
fn merge_field(
208199
&mut self,
209200
tag: u32,
210201
wire_type: WireType,
211-
buf: &mut B,
202+
buf: &mut impl Buf,
212203
ctx: DecodeContext,
213204
) -> Result<(), DecodeError>
214205
where
215-
B: Buf,
216206
Self: Sized,
217207
{
218208
match tag {
@@ -267,9 +257,8 @@ impl prost::Message for BatchCond {
267257
}
268258

269259
impl prost::Message for CursorEntry {
270-
fn encode_raw<B>(&self, buf: &mut B)
260+
fn encode_raw(&self, buf: &mut impl BufMut)
271261
where
272-
B: BufMut,
273262
Self: Sized,
274263
{
275264
match self {
@@ -305,15 +294,14 @@ impl prost::Message for CursorEntry {
305294
}
306295
}
307296

308-
fn merge_field<B>(
297+
fn merge_field(
309298
&mut self,
310299
_tag: u32,
311300
_wire_type: WireType,
312-
_buf: &mut B,
301+
_buf: &mut impl Buf,
313302
_ctx: DecodeContext,
314303
) -> Result<(), DecodeError>
315304
where
316-
B: Buf,
317305
Self: Sized,
318306
{
319307
panic!("CursorEntry can only be encoded, not decoded")
@@ -325,9 +313,8 @@ impl prost::Message for CursorEntry {
325313
}
326314

327315
impl prost::Message for Value {
328-
fn encode_raw<B>(&self, buf: &mut B)
316+
fn encode_raw(&self, buf: &mut impl BufMut)
329317
where
330-
B: BufMut,
331318
Self: Sized,
332319
{
333320
match self {
@@ -351,15 +338,14 @@ impl prost::Message for Value {
351338
}
352339
}
353340

354-
fn merge_field<B>(
341+
fn merge_field(
355342
&mut self,
356343
tag: u32,
357344
wire_type: WireType,
358-
buf: &mut B,
345+
buf: &mut impl Buf,
359346
ctx: DecodeContext,
360347
) -> Result<(), DecodeError>
361348
where
362-
B: Buf,
363349
Self: Sized,
364350
{
365351
match tag {

libsql-server/Cargo.toml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,29 @@ async-lock = "2.6.0"
1515
async-stream = "0.3.5"
1616
async-tempfile = "0.4.0"
1717
async-trait = "0.1.58"
18-
axum = { version = "0.6.18", features = ["headers"] }
19-
axum-extra = { version = "0.7", features = ["json-lines", "query"] }
18+
axum = { version = "0.7", features = [] }
19+
axum-extra = { version = "0.9", features = ["query"] }
2020
base64 = "0.21.0"
2121
bincode = "1.3.3"
2222
bottomless = { version = "0", path = "../bottomless", features = ["libsql_linked_statically"] }
2323
bytes = { version = "1.2.1", features = ["serde"] }
2424
bytesize = { version = "1.2.0", features = ["serde"] }
2525
chrono = { version = "0.4.26", features = ["serde"] }
26-
clap = { version = "4.0.23", features = [ "derive", "env", "string" ] }
26+
clap = { version = "4.0.23", features = ["derive", "env", "string"] }
2727
console-subscriber = { git = "https://github.com/tokio-rs/console.git", rev = "5a80b98", optional = true }
2828
crc = "3.0.0"
2929
enclose = "1.1"
3030
fallible-iterator = "0.3.0"
3131
futures = "0.3.25"
3232
futures-core = "0.3"
3333
hmac = "0.12"
34-
hyper = { workspace = true, features = ["http2"] }
35-
hyper-rustls = { git = "https://github.com/rustls/hyper-rustls.git", rev = "163b3f5", features = ["http2"] }
36-
hyper-tungstenite = "0.11"
34+
http = "1.0"
35+
http-body = "1.0"
36+
http-body-util = "0.1"
37+
hyper = { workspace = true, features = ["http1", "http2", "server"] }
38+
hyper-rustls = { version = "0.27", features = ["http1", "http2", "webpki-roots"] }
39+
hyper-util = { version = "0.1", features = ["client", "client-legacy", "server", "server-auto", "http2", "tokio"] }
40+
hyper-tungstenite = "0.13"
3741
itertools = "0.10.5"
3842
jsonwebtoken = "9"
3943
libsql = { path = "../libsql/", optional = true }
@@ -49,35 +53,35 @@ parking_lot = "0.12.1"
4953
pem = "3.0.4"
5054
pin-project-lite = "0.2.13"
5155
priority-queue = "1.3"
52-
prost = "0.12"
56+
prost = "0.13"
5357
rand = "0.8"
5458
regex = "1.7.0"
55-
reqwest = { version = "0.11.16", features = ["json", "rustls-tls"], default-features = false }
59+
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false }
5660
rusqlite = { workspace = true }
57-
rustls = "0.21.7"
58-
rustls-pemfile = "1.0.3"
61+
rustls = "0.23"
62+
rustls-pemfile = "2.0"
63+
tokio-rustls = "0.26"
5964
semver = "1.0.18"
6065
serde = { version = "1.0.149", features = ["derive", "rc"] }
6166
serde_json = { version = "1.0.91", features = ["preserve_order"] }
6267
md-5 = "0.10"
6368
sha2 = "0.10"
6469
sha256 = "1.1.3"
65-
libsql-sys = { path = "../libsql-sys", features = ["wal", "sqlean-extensions" ], default-features = false }
70+
libsql-sys = { path = "../libsql-sys", features = ["wal", "sqlean-extensions"], default-features = false }
6671
libsql-hrana = { path = "../libsql-hrana" }
67-
sqlite3-parser = { package = "libsql-sqlite3-parser", path = "../vendored/sqlite3-parser", default-features = false, features = [ "YYNOERRORRECOVERY" ] }
72+
sqlite3-parser = { package = "libsql-sqlite3-parser", path = "../vendored/sqlite3-parser", default-features = false, features = ["YYNOERRORRECOVERY"] }
6873
tempfile = "3.7.0"
6974
thiserror = "1.0.38"
7075
tokio = { version = "=1.38", features = ["rt-multi-thread", "net", "io-std", "io-util", "time", "macros", "sync", "fs", "signal"] }
7176
tokio-stream = { version = "0.1.11", features = ["sync"] }
72-
tokio-tungstenite = "0.20"
77+
tokio-tungstenite = "0.24"
7378
tokio-util = { version = "0.7.8", features = ["io", "io-util"] }
74-
tonic = { version = "0.11", features = ["tls"] }
75-
tonic-web = "0.11"
79+
tonic = { version = "0.12", features = ["tls"] }
80+
tonic-web = "0.12"
7681
tower = { workspace = true, features = ["make"] }
77-
tower-http = { version = "0.3.5", features = ["compression-full", "cors", "trace"] }
82+
tower-http = { version = "0.5", features = ["compression-full", "cors", "trace"] }
7883
tracing = "0.1.37"
7984
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
80-
http-body = "0.4"
8185
url = { version = "2.3", features = ["serde"] }
8286
uuid = { version = "1.3", features = ["v4", "serde", "v7"] }
8387
aes = { version = "0.8.3", optional = true }
@@ -101,7 +105,7 @@ arbitrary = { version = "1.3.0", features = ["derive_arbitrary"] }
101105
env_logger = "0.10"
102106
hyper = { workspace = true, features = ["client"] }
103107
insta = { version = "1.26.0", features = ["json"] }
104-
libsql = { path = "../libsql/"}
108+
libsql = { path = "../libsql/" }
105109
libsql-client = { version = "0.6.5", default-features = false, features = ["reqwest_backend"] }
106110
proptest = "1.0.0"
107111
rand = "0.8.5"
@@ -112,8 +116,8 @@ metrics-util = "0.15"
112116
s3s = "0.8.1"
113117
s3s-fs = "0.8.1"
114118
ring = { version = "0.17.8", features = ["std"] }
115-
tonic-build = "0.11"
116-
prost-build = "0.12"
119+
tonic-build = "0.12"
120+
prost-build = "0.13"
117121

118122
[build-dependencies]
119123
vergen = { version = "8", features = ["build", "git", "gitcl"] }

libsql-server/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
22
use std::sync::Arc;
33

44
use anyhow::Context;
5-
use hyper::client::HttpConnector;
5+
use hyper_util::client::legacy::connect::HttpConnector;
66
use hyper_rustls::HttpsConnector;
77
use libsql_sys::EncryptionConfig;
88
use sha256::try_digest;

libsql-server/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use axum::response::IntoResponse;
2-
use hyper::StatusCode;
2+
use http::StatusCode;
33
use tonic::metadata::errors::InvalidMetadataValueBytes;
44

55
use crate::{

0 commit comments

Comments
 (0)