{"id":26560456,"url":"https://github.com/tardy-org/tardy","last_synced_at":"2025-04-05T15:10:19.671Z","repository":{"id":257984685,"uuid":"870344458","full_name":"tardy-org/tardy","owner":"tardy-org","description":"An asynchronous runtime for writing applications and services. Supports io_uring, epoll, kqueue, and poll for I/O. ","archived":false,"fork":false,"pushed_at":"2025-03-06T00:55:38.000Z","size":474,"stargazers_count":132,"open_issues_count":4,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-06T01:34:31.565Z","etag":null,"topics":["async","coroutines","epoll","io-uring","kqueue","net","runtime","zig","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tardy-org.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":"2024-10-09T21:43:08.000Z","updated_at":"2025-03-06T00:56:50.000Z","dependencies_parsed_at":"2024-11-09T01:39:14.335Z","dependency_job_id":"4f64d6ca-16c1-46f3-8bbc-dd476c6183d6","html_url":"https://github.com/tardy-org/tardy","commit_stats":{"total_commits":65,"total_committers":2,"mean_commits":32.5,"dds":0.01538461538461533,"last_synced_commit":"e516a69d03d73b7f6e6c377abd7d19326250d087"},"previous_names":["mookums/tardy","tardy-org/tardy"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tardy-org%2Ftardy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tardy-org%2Ftardy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tardy-org%2Ftardy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tardy-org%2Ftardy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tardy-org","download_url":"https://codeload.github.com/tardy-org/tardy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353749,"owners_count":20925329,"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","epoll","io-uring","kqueue","net","runtime","zig","zig-package"],"created_at":"2025-03-22T13:10:53.153Z","updated_at":"2025-04-05T15:10:19.649Z","avatar_url":"https://github.com/tardy-org.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tardy\n\ntardy *(def: delaying or delayed beyond the right or expected time; late.)* is an asynchronous runtime for writing applications and services in Zig.\nMost of the code for this project originated in [zzz](https://github.com/tardy-org/zzz), a performance oriented networking framework.\n\n- tardy utilizes the latest Asynchronous APIs while minimizing allocations.\n- tardy natively supports Linux, Mac, BSD, and Windows.\n- tardy is configurable, allowing you to optimize the runtime for your specific use-case.\n\n[![Discord](https://img.shields.io/discord/1294761432922980392?logo=discord)](https://discord.gg/FP9Xb7WGPK)\n\n## Summary\ntardy is a thread-local, I/O driven runtime for Zig, providing the core implementation for asynchronous libraries and services.\n- Per-thread Runtime isolation for minimal contention\n- Native async I/O (io_uring, epoll, kqueue, poll, etc.)\n- Asynchronous `Socket`s and `File`s.\n- Coroutines (internally called Frames).\n\n## Installing\nCompatible Zig Version: `0.14.0`\n\nLatest Release: `0.3.0`\n```\nzig fetch --save git+https://github.com/tardy-org/tardy#v0.3.0\n```\n\nYou can then add the dependency in your `build.zig` file:\n```zig\nconst tardy = b.dependency(\"tardy\", .{\n    .target = target,\n    .optimize = optimize,\n}).module(\"tardy\");\n\nexe_mod.addImport(\"tardy\", tardy);\n```\n\n## Building and Running Examples\n- NOTE: by default build/install step uses `-Dexample=none` , meaning it wont build any examples\n\n- List available examples\n```sh\nzig build --help\n```\n\n- Build/run a specific example\n```sh\nzig build -Dexample=[nameOfExample]\n```\n```sh\nzig build run -Dexample=[nameOfExample]\n```\n\n- Build all examples\n```sh\nzig build -Dexample=all\n```\n\n## TCP Example\nA basic multi-threaded TCP echo server.\n\n```zig\nconst std = @import(\"std\");\nconst log = std.log.scoped(.@\"tardy/example/echo\");\n\nconst Pool = @import(\"tardy\").Pool;\nconst Runtime = @import(\"tardy\").Runtime;\nconst Task = @import(\"tardy\").Task;\nconst Tardy = @import(\"tardy\").Tardy(.auto);\nconst Cross = @import(\"tardy\").Cross;\n\nconst Socket = @import(\"tardy\").Socket;\nconst Timer = @import(\"tardy\").Timer;\n\nconst AcceptResult = @import(\"tardy\").AcceptResult;\nconst RecvResult = @import(\"tardy\").RecvResult;\nconst SendResult = @import(\"tardy\").SendResult;\n\nfn echo_frame(rt: *Runtime, server: *const Socket) !void {\n    const socket = try server.accept(rt);\n    defer socket.close_blocking();\n\n    // you can use the standard Zig Reader/Writer if you want!\n    const reader = socket.reader(rt);\n    const writer = socket.writer(rt);\n\n    log.debug(\n        \"{d} - accepted socket [{}]\",\n        .{ std.time.milliTimestamp(), socket.addr },\n    );\n\n    try rt.spawn(.{ rt, server }, echo_frame, 1024 * 16);\n\n    var buffer: [1024]u8 = undefined;\n    while (true) {\n        const recv_length = reader.read(\u0026buffer) catch |e| {\n            log.err(\"Failed to recv on socket | {}\", .{e});\n            return;\n        };\n\n        writer.writeAll(buffer[0..recv_length]) catch |e| {\n            log.err(\"Failed to send on socket | {}\", .{e});\n            return;\n        };\n\n        log.debug(\"Echoed: {s}\", .{buffer[0..recv_length]});\n    }\n}\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    const allocator = gpa.allocator();\n    defer _ = gpa.deinit();\n\n    // tardy by default is \n    // - multithreaded\n    // - unbounded in terms of spawnable tasks\n    var tardy = try Tardy.init(allocator, .{});\n    defer tardy.deinit();\n\n    const server = try Socket.init(.{ .tcp = .{ .host = \"127.0.0.1\", .port = 9862 } });\n    try server.bind();\n    try server.listen(256);\n\n    try tardy.entry(\n        \u0026server,\n        struct {\n            fn start(rt: *Runtime, tcp_server: *const Socket) !void {\n                try rt.spawn(.{ rt, tcp_server }, echo_frame, 1024 * 1024 * 4);\n            }\n        }.start,\n    );\n}\n```\n\nThere exist a lot more examples, highlighting a variety of use cases and features [here](https://github.com/tardy-org/tardy/tree/main/examples). For an example of tardy in use, you can check out any of the projects in the [ecosystem](#ecosystem).\n\n## Ecosystem\n- [zzz](https://github.com/tardy-org/zzz): a framework for writing performant and reliable networked services.\n- [secsock](https://github.com/tardy-org/secsock): Async TLS for the Tardy Socket.\n\n## Contribution\nWe use Nix Flakes for managing the development environment. Nix Flakes provide a reproducible, declarative approach to managing dependencies and development tools.\n\n### Prerequisites\n - Install [Nix](https://nixos.org/download/)\n```bash \nsh \u003c(curl -L https://nixos.org/nix/install) --daemon\n```\n - Enable [Flake support](https://nixos.wiki/wiki/Flakes) in your Nix config (`~/.config/nix/nix.conf`): `experimental-features = nix-command flakes`\n\n### Getting Started\n1. Clone this repository:\n```bash\ngit clone https://github.com/tardy-org/tardy.git\ncd tardy\n```\n\n2. Enter the development environment:\n```bash\nnix develop\n```\n\nThis will provide you with a shell that contains all of the necessary tools and dependencies for development.\n\nOnce you are inside of the development shell, you can update the development dependencies by:\n1. Modifying the `flake.nix`\n2. Running `nix flake update`\n3. Committing both the `flake.nix` and the `flake.lock`\n\n### License\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tardy by you, shall be licensed as MPL2.0, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftardy-org%2Ftardy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftardy-org%2Ftardy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftardy-org%2Ftardy/lists"}