{"id":13626566,"url":"https://github.com/ziglibs/antiphony","last_synced_at":"2025-04-12T03:24:29.470Z","repository":{"id":38371242,"uuid":"462362674","full_name":"ziglibs/antiphony","owner":"ziglibs","description":"A zig remote procedure call solution","archived":false,"fork":false,"pushed_at":"2024-03-04T10:14:21.000Z","size":8194,"stargazers_count":40,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T23:01:38.716Z","etag":null,"topics":["rpc","rpc-framework","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/ziglibs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"MasterQ32"}},"created_at":"2022-02-22T15:39:09.000Z","updated_at":"2025-02-17T03:21:10.000Z","dependencies_parsed_at":"2024-01-25T05:49:49.491Z","dependency_job_id":null,"html_url":"https://github.com/ziglibs/antiphony","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/ziglibs%2Fantiphony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fantiphony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fantiphony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fantiphony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziglibs","download_url":"https://codeload.github.com/ziglibs/antiphony/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511062,"owners_count":21116345,"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":["rpc","rpc-framework","zig","zig-package","ziglang"],"created_at":"2024-08-01T21:02:23.949Z","updated_at":"2025-04-12T03:24:29.447Z","avatar_url":"https://github.com/ziglibs.png","language":"Zig","funding_links":["https://github.com/sponsors/MasterQ32"],"categories":["Zig","Libraries"],"sub_categories":[],"readme":"# Antiphony\n\nA simple Zig remote procedure call library.\n\n![Project Logo](design/logo.png)\n\n## Features\n\n- Transport layer agnostic\n- Support for nearly every non-generic function signature.\n- Nestable remote calls (peer calls host calls peer calls host calls ...)\n- Easy to use\n\n## API\n\n```zig\n// (comptime details left out for brevity)\n\npub fn CreateDefinition(spec: anytype) type {\n    return struct {\n        pub fn HostEndPoint(Reader: type, Writer: type, Implementation: type) type {\n            return CreateEndPoint(.host, Reader, Writer, Implementation);\n        }\n        pub fn ClientEndPoint(Reader: type, Writer: type, Implementation: type) type {\n            return CreateEndPoint(.client, Reader, Writer, Implementation);\n        }\n        pub fn CreateEndPoint(role: Role, ReaderType: type, WriterType: type, ImplementationType: type) type {\n            return struct {\n                const EndPoint = @This();\n\n                pub const Reader = Reader;\n                pub const Writer = Writer;\n                pub const Implementation = Implementation;\n\n                pub const IoError = error{ ... };\n                pub const ProtocolError = error{ ... };\n                pub const InvokeError = error{ ... };\n                pub const ConnectError = error{ ... };\n\n                pub fn init(allocator: std.mem.Allocator, reader: Reader, writer: Writer) EndPoint;\n                pub fn destroy(self: *EndPoint) void;\n                pub fn connect(self: *EndPoint, impl: *Implementation) ConnectError!void;\n                pub fn shutdown(self: *EndPoint) IoError!void;\n                pub fn acceptCalls(self: *EndPoint) InvokeError!void;\n                pub fn invoke(self: *EndPoint, func_name: []const u8, args: anytype) InvokeError!Result(func_name);\n            };\n        }\n    };\n}\n\n// Example for CreateDefinition(spec):\nconst Definition = antiphony.CreateDefinition(.{\n    .host = .{\n        // add all functions the host implements:\n        .createCounter = fn () CreateError!u32,\n        .destroyCounter = fn (u32) void,\n        .increment = fn (u32, u32) UsageError!u32,\n        .getCount = fn (u32) UsageError!u32,\n    },\n    .client = .{\n        // add all functions the client implements:\n        .signalError = fn (msg: []const u8) void,\n    },\n\n    // this is optional and can be left out:\n    .config = .{\n        // defines how to handle remote error sets:\n        .merge_error_sets = true,\n    },\n});\n```\n\n## Project Status\n\nThis project is currently in testing phase, all core features are already implemented and functional.\n\n## Contribution\n\nContributions are welcome as long as they don't change unnecessarily increase the complexity of the library. This library is meant to be the bare minimum RPC implementation that is well usable. Bug fixes and updates to new versions are always welcome.\n\n### Compile and run the examples\n\n```sh-session\n[user@host antiphony]$ zig build install\n[user@host antiphony]$ ./zig-out/bin/socketpair-example\ninfo: first increment:  0\ninfo: second increment: 5\ninfo: third increment:  8\ninfo: final count:      15\nerror: remote error: This counter was already deleted!\ninfo: error while calling getCount()  with invalid handle: UnknownCounter\n[user@host antiphony]$\n```\n\n### Run the test suite\n\n```sh-session\n[user@host antiphony]$ zig build test\nTest [3/6] test \"invoke function (emulated client, no self parameter)\"... some(1334, 3.1415927410125732, \"Hello, Host!\");\nTest [4/6] test \"invoke function (emulated client, with self parameter)\"... some(123, 1334, 3.1415927410125732, \"Hello, Host!\");\nTest [5/6] test \"invoke function with callback (emulated host, no self parameter)\"... callback(\"Hello, World!\");\nTest [6/6] test \"invoke function with callback (emulated host, with self parameter)\"... callback(ClientImpl@7ffd33f6cdc0, \"Hello, World!\");\nAll 6 tests passed.\n[user@host antiphony]$\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziglibs%2Fantiphony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziglibs%2Fantiphony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziglibs%2Fantiphony/lists"}