{"id":18616715,"url":"https://github.com/sile/fibers_rpc","last_synced_at":"2025-04-11T01:32:09.410Z","repository":{"id":57629008,"uuid":"124176592","full_name":"sile/fibers_rpc","owner":"sile","description":"Rust RPC library built on top of fibers crate","archived":false,"fork":false,"pushed_at":"2020-09-07T14:36:06.000Z","size":204,"stargazers_count":7,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T07:12:39.160Z","etag":null,"topics":["asynchronous","rpc","rust"],"latest_commit_sha":null,"homepage":null,"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/sile.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}},"created_at":"2018-03-07T03:57:48.000Z","updated_at":"2022-11-28T23:57:33.000Z","dependencies_parsed_at":"2022-09-26T20:10:57.683Z","dependency_job_id":null,"html_url":"https://github.com/sile/fibers_rpc","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Ffibers_rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Ffibers_rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Ffibers_rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Ffibers_rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sile","download_url":"https://codeload.github.com/sile/fibers_rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248290465,"owners_count":21078993,"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":["asynchronous","rpc","rust"],"created_at":"2024-11-07T03:37:40.645Z","updated_at":"2025-04-11T01:32:09.108Z","avatar_url":"https://github.com/sile.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"fibers_rpc\n==========\n\n[![fibers_rpc](http://meritbadge.herokuapp.com/fibers_rpc)](https://crates.io/crates/fibers_rpc)\n[![Documentation](https://docs.rs/fibers_rpc/badge.svg)](https://docs.rs/fibers_rpc)\n[![Build Status](https://travis-ci.org/sile/fibers_rpc.svg?branch=master)](https://travis-ci.org/sile/fibers_rpc)\n[![Code Coverage](https://codecov.io/gh/sile/fibers_rpc/branch/master/graph/badge.svg)](https://codecov.io/gh/sile/fibers_rpc/branch/master)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nRust RPC library built on top of [fibers] crate.\n\n[Documentation](https://docs.rs/fibers_rpc)\n\n[fibers]: https://github.com/dwango/fibers-rs\n\nFeatures\n---------\n\n- Asynchronous RPC server/client using [fibers] crate\n- Support two type of RPC:\n  - Request/response model\n  - Notification model\n- Strongly typed RPC using [bytecodec] crate\n  - You can treat arbitrarily Rust structures that support [serde] as RPC messages\n  - It is possible to handle huge structures as RPC messages without compromising efficiency and real-time property by implementing your own encoder/decoder\n- Multiplexing multiple RPC messages in a single TCP stream\n- Prioritization between messages\n- Expose [Prometheus] metrics\n\n[fibers]: https://github.com/dwango/fibers-rs\n[bytecodec]: https://github.com/sile/bytecodec\n[serde]: https://crates.io/crates/serde\n[Prometheus]: https://prometheus.io/\n\nTechnical Details\n-----------------\n\nSee [doc/].\n\n[doc/]: https://github.com/sile/fibers_rpc/tree/master/doc\n\nExamples\n--------\n\nSimple echo RPC server:\n```rust\nuse bytecodec::bytes::{BytesEncoder, RemainingBytesDecoder};\nuse fibers_rpc::{Call, ProcedureId};\nuse fibers_rpc::client::ClientServiceBuilder;\nuse fibers_rpc::server::{HandleCall, Reply, ServerBuilder};\nuse futures::Future;\n\n// RPC definition\nstruct EchoRpc;\nimpl Call for EchoRpc {\n    const ID: ProcedureId = ProcedureId(0);\n    const NAME: \u0026'static str = \"echo\";\n\n    type Req = Vec\u003cu8\u003e;\n    type ReqEncoder = BytesEncoder\u003cVec\u003cu8\u003e\u003e;\n    type ReqDecoder = RemainingBytesDecoder;\n\n    type Res = Vec\u003cu8\u003e;\n    type ResEncoder = BytesEncoder\u003cVec\u003cu8\u003e\u003e;\n    type ResDecoder = RemainingBytesDecoder;\n}\n\n// RPC server\nstruct EchoHandler;\nimpl HandleCall\u003cEchoRpc\u003e for EchoHandler {\n    fn handle_call(\u0026self, request: \u003cEchoRpc as Call\u003e::Req) -\u003e Reply\u003cEchoRpc\u003e {\n        Reply::done(request)\n    }\n}\nlet server_addr = \"127.0.0.1:1919\".parse().unwrap();\nlet mut builder = ServerBuilder::new(server_addr);\nbuilder.add_call_handler(EchoHandler);\nlet server = builder.finish(fibers_global::handle());\nfibers_global::spawn(server.map_err(|e| panic!(\"{}\", e)));\n\n// RPC client\nlet service = ClientServiceBuilder::new().finish(fibers_global::handle());\nlet service_handle = service.handle();\nfibers_global::spawn(service.map_err(|e| panic!(\"{}\", e)));\n\nlet request = Vec::from(\u0026b\"hello\"[..]);\nlet response = EchoRpc::client(\u0026service_handle).call(server_addr, request.clone());\nlet response = fibers_global::execute(response)?;\nassert_eq!(response, request);\n```\n\nInformal benchmark result (v0.2.1):\n\n```console\n$ uname -a\nLinux DESKTOP 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux\n\n$ lscpu | grep 'Model name:'\nModel name:            Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz\n\n// Runs the example echo server in a shell.\n$ cargo run --example echo --release -- server\n\n// Executes a benchmark command in another shell.\n$ echo \"hello\" | cargo run --example echo --release -- bench -c 1024 -n 1000000\n# ELAPSED: 8.111424\n# RPS: 123282.91555218912\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Ffibers_rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsile%2Ffibers_rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Ffibers_rpc/lists"}