{"id":16941233,"url":"https://github.com/iceber/iouring-go","last_synced_at":"2025-09-07T01:08:24.519Z","repository":{"id":38196674,"uuid":"302874413","full_name":"Iceber/iouring-go","owner":"Iceber","description":"Provides easy-to-use async IO interface with io_uring","archived":false,"fork":false,"pushed_at":"2023-11-20T10:06:37.000Z","size":127,"stargazers_count":553,"open_issues_count":10,"forks_count":40,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-05-22T14:33:49.257Z","etag":null,"topics":["go","golang","io-uring","iouring"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Iceber.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":"2020-10-10T10:19:01.000Z","updated_at":"2024-06-18T13:47:56.794Z","dependencies_parsed_at":"2024-06-18T13:47:54.623Z","dependency_job_id":"af4cd262-6ce4-41c4-b9b7-0ab535f6fc4d","html_url":"https://github.com/Iceber/iouring-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iceber%2Fiouring-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iceber%2Fiouring-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iceber%2Fiouring-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iceber%2Fiouring-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Iceber","download_url":"https://codeload.github.com/Iceber/iouring-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618214,"owners_count":21134199,"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":["go","golang","io-uring","iouring"],"created_at":"2024-10-13T21:09:01.732Z","updated_at":"2025-04-12T18:48:33.037Z","avatar_url":"https://github.com/Iceber.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is io_uring\n[io_uring](http://kernel.dk/io_uring.pdf) \n\n[io_uring-wahtsnew](https://kernel.dk/io_uring-whatsnew.pdf) \n\n[LWN io_uring](https://lwn.net/Kernel/Index/#io_uring) \n\n[Lord of the io_uring](https://unixism.net/loti/)\n\n[【译】高性能异步 IO —— io_uring (Effecient IO with io_uring)](http://icebergu.com/archives/linux-iouring)\n\n[Go 与异步 IO - io_uring 的思考](http://icebergu.com/archives/go-iouring)\n\n# Features\n- [x] register a file set for io_uring instance\n- [x] support file IO\n- [x] support socket IO\n- [x] support IO timeout\n- [x] link request\n- [x] set timer\n- [x] add request extra info, could get it from the result\n- [ ] set logger\n- [ ] register buffers and IO with buffers\n- [ ] support SQPoll \n\n# OS Requirements\n* Linux Kernel \u003e= 5.6\n\n\n# Installation\n```\ngo get github.com/iceber/iouring-go\n```\n[doc](https://pkg.go.dev/github.com/iceber/iouring-go)\n\n# Quickstart\n```golang\npackage main\n\nimport (\n        \"fmt\"\n        \"os\"\n\n        \"github.com/iceber/iouring-go\"\n)\n\nvar str = \"io with iouring\"\n\nfunc main() {\n        iour, err := iouring.New(1)\n        if err != nil {\n                panic(fmt.Sprintf(\"new IOURing error: %v\", err))\n        }\n        defer iour.Close()\n\n        file, err := os.Create(\"./tmp.txt\")\n        if err != nil {\n                panic(err)\n        }\n\n        ch := make(chan iouring.Result, 1)\n\n        prepRequest := iouring.Write(int(file.Fd()), []byte(str))\n        if _, err := iour.SubmitRequest(prepRequest, ch); err != nil {\n                panic(err)\n        }\n\n        result := \u003c-ch\n        i, err := result.ReturnInt()\n        if err != nil {\n                fmt.Println(\"write error: \", err)\n                return\n        }\n\n        fmt.Printf(\"write byte: %d\\n\", i)\n}\n```\n\n# Request With Extra Info\n```golang\nprepRequest := iouring.Write(int(file.Fd()), []byte(str)).WithInfo(file.Name())\n\nrequest, err := iour.SubmitRequest(prepRequest, nil)\nif err != nil {\n    panic(err)\n}\n\n\u003c- request.Done()\ninfo, ok := request.GetRequestInfo().(string)\n```\n\n# Cancel Request\n```golang\nprepR := iouring.Timeout(5 * time.Second)\nrequest, err := iour.SubmitRequest(prepR, nil)\nif err != nil {\n    panic(err)\n}\n\nif _, err := request.Cancel(); err != nil{\n    fmt.Printf(\"cancel request error: %v\\n\", err)\n    return\n}\n\n\u003c- request.Done()\nif err := request.Err(); err != nil{\n    if err == iouring.ErrRequestCanceled{\n        fmt.Println(\"request is canceled\"0\n        return\n    }\n    fmt.Printf(\"request error: %v\\n\", err)\n    return\n}\n```\n\n\n# Submit multitude request\n\n```golang\nvar offset uint64\nbuf1 := make([]byte, 1024)\nprep1:= iouring.Pread(fd, buf1, offset)\n\noffset += 1024\nbuf2 := make([]byte, 1024)\nprep2:= iouring.Pread(fd, buf1, offset)\n\nrequests, err := iour.SubmitRequests([]iouring.PrepRequest{prep1,prep2}, nil)\nif err != nil{\n    panic(err)\n}\n\u003c- requests.Done()\nfmt.Println(\"requests are completed\")\n```\nrequests is concurrent execution\n\n# Link request\n```golang\nvar offset uint64\nbuf := make([]byte, 1024)\nprep1 := iouring.Pread(fd, buf1, offset)\nprep2 := iouring.Write(int(os.Stdout.Fd()), buf)\n\niour.SubmitLinkRequests([]iouring.PrepRequest{prep1, prep2}, nil)\n```\n\n# Examples\n[cat](https://github.com/Iceber/iouring-go/tree/main/examples/cat)\n\n[concurrent-cat](https://github.com/Iceber/iouring-go/tree/main/examples/concurrent-cat)\n\n[cp](https://github.com/Iceber/iouring-go/tree/main/examples/cp)\n\n[request-with-timeout](https://github.com/Iceber/iouring-go/tree/main/examples/timeout/request-with-timeout)\n\n[link-request](https://github.com/Iceber/iouring-go/tree/main/examples/link)\n\n[link-with-timeout](https://github.com/Iceber/iouring-go/tree/main/examples/timeout/link-with-timeout)\n\n[timer](https://github.com/Iceber/iouring-go/tree/main/examples/timeout/timer)\n\n[echo](https://github.com/Iceber/iouring-go/tree/main/examples/echo)\n\n[echo-with-callback](https://github.com/Iceber/iouring-go/tree/main/examples/echo-with-callback)\n\n# TODO\n* add tests\n* arguments type (eg. int and int32)\n* set logger\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficeber%2Fiouring-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficeber%2Fiouring-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficeber%2Fiouring-go/lists"}