Skip to content

Add smol as an executor #3790

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fb3f254
Sqlx-core: rename async_io dependency for async-std
martin-kolarik Mar 2, 2025
31553e7
Sqlx-core: simplify TimeoutError
martin-kolarik Mar 2, 2025
0c12744
Sqlx-core: code for async-global-executor
martin-kolarik Mar 2, 2025
6c324b1
Sqlx: integrate async-global-executor feature
martin-kolarik Mar 2, 2025
46f8400
Merge with upstream
martin-kolarik Mar 2, 2025
40f3d8d
Note to unsafe
martin-kolarik Mar 2, 2025
375b493
Step up MSRV as async-global-executor needs it
martin-kolarik Mar 2, 2025
aef441b
Sqlx-core: fix of unix socket build
martin-kolarik Mar 2, 2025
f5e374a
Unsafe fixes, smol executor added
martin-kolarik Mar 16, 2025
7de5718
Workflow fix
martin-kolarik Mar 16, 2025
b462f43
Changes outside sqlx_rt
martin-kolarik Mar 16, 2025
4f851b0
Cleanup conditional rt compilation
martin-kolarik Mar 17, 2025
4eadb24
Warning
martin-kolarik Mar 17, 2025
dd053e1
Merge branch 'temp'
martin-kolarik Mar 17, 2025
aa29a3e
Add executors to test matrix
martin-kolarik Mar 17, 2025
89faf0e
Fix of skipping code sqlite due to mismatch in cargo feature names
martin-kolarik Mar 17, 2025
8cc0f5c
Merge remote-tracking branch 'origin/sqlx-cli-sqlite-create-WAL-db-fix'
martin-kolarik Mar 17, 2025
ddcf4ed
Smol executor isolated
martin-kolarik Mar 17, 2025
653152a
Fix, reduce number of tests, remove async_std
martin-kolarik Mar 17, 2025
d1e91f6
Fix of test_block_on, regression
martin-kolarik Mar 17, 2025
5627ca8
Format fixes
martin-kolarik Mar 17, 2025
580b8df
Merge branch 'launchbadge:main' into main
martin-kolarik Apr 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/sqlx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
runtime: [ async-std, tokio ]
runtime: [ smol, tokio ]
tls: [ native-tls, rustls, none ]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
runtime: [ async-std, tokio ]
runtime: [ smol, tokio ]
linking: [ sqlite, sqlite-unbundled ]
needs: check
steps:
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
strategy:
matrix:
postgres: [ 17, 13 ]
runtime: [ async-std, tokio ]
runtime: [ smol, tokio ]
tls: [ native-tls, rustls-aws-lc-rs, rustls-ring, none ]
needs: check
steps:
Expand Down Expand Up @@ -288,7 +288,7 @@ jobs:
strategy:
matrix:
mysql: [ 8 ]
runtime: [ async-std, tokio ]
runtime: [ smol, tokio ]
tls: [ native-tls, rustls-aws-lc-rs, rustls-ring, none ]
needs: check
steps:
Expand Down Expand Up @@ -377,7 +377,7 @@ jobs:
strategy:
matrix:
mariadb: [ verylatest, 11_4, 10_11, 10_4 ]
runtime: [ async-std, tokio ]
runtime: [ smol, tokio ]
tls: [ native-tls, rustls-aws-lc-rs, rustls-ring, none ]
needs: check
steps:
Expand Down
80 changes: 80 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ _unstable-all-types = [

# Base runtime features without TLS
runtime-async-std = ["_rt-async-std", "sqlx-core/_rt-async-std", "sqlx-macros?/_rt-async-std"]
runtime-smol = ["_rt-smol", "sqlx-core/_rt-smol", "sqlx-macros?/_rt-smol"]
runtime-tokio = ["_rt-tokio", "sqlx-core/_rt-tokio", "sqlx-macros?/_rt-tokio"]

# TLS features
Expand All @@ -96,11 +97,15 @@ tls-none = []
runtime-async-std-native-tls = ["runtime-async-std", "tls-native-tls"]
runtime-async-std-rustls = ["runtime-async-std", "tls-rustls-ring"]

runtime-smol-native-tls = ["runtime-smol", "tls-native-tls"]
runtime-smol-rustls = ["runtime-smol", "tls-rustls-ring"]

runtime-tokio-native-tls = ["runtime-tokio", "tls-native-tls"]
runtime-tokio-rustls = ["runtime-tokio", "tls-rustls-ring"]

# for conditional compilation
_rt-async-std = []
_rt-smol = []
_rt-tokio = []
_sqlite = []

Expand Down Expand Up @@ -154,12 +159,17 @@ time = { version = "0.3.36", features = ["formatting", "parsing", "macros"] }
uuid = "1.1.2"

# Common utility crates
cfg-if = "1.0.0"
dotenvy = { version = "0.15.0", default-features = false }

# Runtimes
[workspace.dependencies.async-std]
version = "1.12"

[workspace.dependencies.smol]
version = "2.0"
default-features = false

[workspace.dependencies.tokio]
version = "1"
features = ["time", "net", "sync", "fs", "io-util", "rt"]
Expand Down
2 changes: 1 addition & 1 deletion sqlx-cli/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub async fn create(connect_opts: &ConnectOpts) -> anyhow::Result<()> {
let exists = crate::retry_connect_errors(connect_opts, Any::database_exists).await?;

if !exists {
#[cfg(feature = "_sqlite")]
#[cfg(any(feature = "sqlite", feature = "sqlite-unbundled"))]
sqlx::sqlite::CREATE_DB_WAL.store(
connect_opts.sqlite_create_db_wal,
std::sync::atomic::Ordering::Release,
Expand Down
2 changes: 1 addition & 1 deletion sqlx-cli/src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub struct ConnectOpts {
/// However, if your application sets a `journal_mode` on `SqliteConnectOptions` to something
/// other than `Wal`, then it will have to take the database file out of WAL mode on connecting,
/// which requires an exclusive lock and may return a `database is locked` (`SQLITE_BUSY`) error.
#[cfg(feature = "_sqlite")]
#[cfg(any(feature = "sqlite", feature = "sqlite-unbundled"))]
#[clap(long, action = clap::ArgAction::Set, default_value = "true")]
pub sqlite_create_db_wal: bool,
}
Expand Down
5 changes: 4 additions & 1 deletion sqlx-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ json = ["serde", "serde_json"]

# for conditional compilation
_rt-async-std = ["async-std", "async-io"]
_rt-smol = ["smol"]
_rt-tokio = ["tokio", "tokio-stream"]
_tls-native-tls = ["native-tls"]
_tls-rustls-aws-lc-rs = ["_tls-rustls", "rustls/aws-lc-rs", "webpki-roots"]
Expand All @@ -34,6 +35,7 @@ offline = ["serde", "either/serde"]
[dependencies]
# Runtimes
async-std = { workspace = true, optional = true }
smol = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }

# TLS
Expand All @@ -53,9 +55,10 @@ ipnetwork = { workspace = true, optional = true }
mac_address = { workspace = true, optional = true }
uuid = { workspace = true, optional = true }

async-io = { version = "1.9.0", optional = true }
async-io = { package = "async-io", version = "1.9.0", optional = true }
base64 = { version = "0.22.0", default-features = false, features = ["std"] }
bytes = "1.1.0"
cfg-if = { workspace = true }
chrono = { version = "0.4.34", default-features = false, features = ["clock"], optional = true }
crc = { version = "3", optional = true }
crossbeam-queue = "0.3.2"
Expand Down
Loading
Loading