{"id":16767953,"url":"https://github.com/davidzeng0/aurora","last_synced_at":"2025-11-02T03:30:28.481Z","repository":{"id":199609630,"uuid":"701925199","full_name":"davidzeng0/aurora","owner":"davidzeng0","description":"I/O at the speed of light. Safe abstractions for io_uring on stackful coroutines.","archived":false,"fork":false,"pushed_at":"2025-02-14T00:54:56.000Z","size":232,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T01:38:49.460Z","etag":null,"topics":["async","coroutines","io-uring","rust","stackful"],"latest_commit_sha":null,"homepage":"https://davidzeng0.github.io/aurora","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidzeng0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-08T01:20:51.000Z","updated_at":"2025-02-14T00:55:00.000Z","dependencies_parsed_at":"2023-10-11T07:33:46.077Z","dependency_job_id":"a5a1b02e-89d4-4429-b321-5a5a91261f22","html_url":"https://github.com/davidzeng0/aurora","commit_stats":null,"previous_names":["davidzeng0/xx-pulse","davidyz0/xx-pulse","davidyz0/aurora","davidzeng0/aurora"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidzeng0%2Faurora","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidzeng0%2Faurora/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidzeng0%2Faurora/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidzeng0%2Faurora/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidzeng0","download_url":"https://codeload.github.com/davidzeng0/aurora/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239054608,"owners_count":19574159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","coroutines","io-uring","rust","stackful"],"created_at":"2024-10-13T06:10:25.150Z","updated_at":"2025-11-02T03:30:28.437Z","avatar_url":"https://github.com/davidzeng0.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xx-pulse\n\n![](https://github.com/davidyz0/xx-pulse/actions/workflows/build.yml/badge.svg?event=push)\n\n`msrv: 1.80.0 stable`\n\n[Documentation](https://davidyz0.github.io/aurora)\n\nI/O at the speed of light. See [benchmarks](./benchmarks/README.md).\n\n- [Getting started](#getting-started)\n- [Thread local safety](#thread-local-safety)\n- [Motivation and use cases](./Motivation.md)\n\n### Note:\n\nThis library is not ready for production use. Many semantics and APIs are still under development.\n\nThis library is currently only available for Linux (kernel 5.6+, other OS's contributions are welcome).\u003cbr\u003e\nFor Windows and Mac users, running in Docker or WSL also work.\n\nThe [rust](https://hub.docker.com/_/rust) docker container is sufficient.\n\n### Getting started\n\nThe following is a simple echo server example\n\n#### Add dependency\n```sh\n# support lib and async impls\ncargo add --git https://github.com/davidyz0/xx-core.git xx-core\n\n# i/o engine and driver\ncargo add --git https://github.com/davidyz0/xx-pulse.git xx-pulse\n```\n\nIn file `main.rs`\n```rust\nuse xx_pulse::{Tcp, TcpListener};\nuse xx_pulse::impls::TaskExt;\nuse xx_core::error::{Error, Result};\nuse xx_core::macros::duration;\n\n#[xx_pulse::main]\nasync fn main() -\u003e Result\u003c()\u003e {\n    let listener = Tcp::bind(\"127.0.0.1:8080\").await?;\n\n    // Can also timeout operations after 5s\n    let listener2: Option\u003cResult\u003cTcpListener\u003e\u003e = Tcp::bind(\"...\")\n        .timeout(duration!(5 s))\n        .await;\n\n    loop {\n        let (mut client, _) = listener.accept().await?;\n\n        xx_pulse::spawn(async move {\n            let mut buf = [0; 1024];\n\n            loop {\n                let n = client.recv(\u0026mut buf, Default::default()).await?;\n\n                if n == 0 {\n                    break;\n                }\n\n                let n = client.send(\u0026buf, Default::default()).await?;\n\n                if n == 0 {\n                    break;\n                }\n            }\n\n            Ok::\u003c_, Error\u003e(())\n        }).await;\n    }\n}\n```\n\n### Thread local safety\n\nThread local access is safe because of async/await syntax. \u003cbr\u003e\nA compiler error prevents usage of `.await` in synchronous functions and closures. \u003cbr\u003e\nxx-pulse uses cooperative scheduling, so it is impossble to suspend in a closure without using `unsafe`. \u003cbr\u003e\nTo suspend anyway, see [using sync code as if it were async](./Motivation.md#use-sync-code-as-if-it-were-async)\n\n```rust\n#[asynchronous]\nasync fn try_use_thread_local() {\n\tTHREAD_LOCAL.with(|value| {\n\t\t// Ok, cannot cause UB\n\t\tuse_value_synchronously(value);\n\t});\n\n\tTHREAD_LOCAL.with(|value| {\n\t\t// Compiler error: cannot use .await in a synchronous function/closure!\n\t\tdo_async_stuff().await;\n\t});\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidzeng0%2Faurora","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidzeng0%2Faurora","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidzeng0%2Faurora/lists"}