|
16 | 16 |
|
17 | 17 | # RoadRunner API |
18 | 18 |
|
19 | | -To install and use generated packages: |
| 19 | +This repository contains the **Protocol Buffer definitions** for [RoadRunner](https://roadrunner.dev). These protos are used for external integrations (RPC) and internal communications between RoadRunner plugins. |
| 20 | + |
| 21 | +Generated Go code lives in a separate repository: [`roadrunner-server/api-go`](https://github.com/roadrunner-server/api-go). |
| 22 | + |
| 23 | +## Repository structure |
| 24 | + |
| 25 | +``` |
| 26 | +roadrunner/api/ — RoadRunner proto definitions (jobs, kv, http, status, etc.) |
| 27 | +third_party/api/ — Temporal API submodule (used as a proto dependency) |
| 28 | +buf.yaml — Buf module configuration |
| 29 | +buf.gen.yaml — Buf code generation configuration |
| 30 | +``` |
| 31 | + |
| 32 | +## Using generated Go packages |
| 33 | + |
| 34 | +Install a package from the [`api-go`](https://github.com/roadrunner-server/api-go) repository: |
20 | 35 | ```bash |
21 | | -go get github.com/roadrunner-server/api/v4/build/<API_NAME>/v1 |
| 36 | +go get github.com/roadrunner-server/api-go/v5/build/<module>/<version> |
22 | 37 | ``` |
23 | 38 |
|
24 | | -The Proto API is used for external integrations, mostly for RPC or as internal communications. For example: |
| 39 | +Example usage: |
25 | 40 | ```go |
26 | 41 | package foo |
27 | 42 |
|
28 | 43 | import ( |
29 | | - jobsv1 "github.com/roadrunner-server/api/v4/build/jobs/v1" |
| 44 | + jobsv1 "github.com/roadrunner-server/api-go/v5/build/jobs/v1" |
30 | 45 | ) |
31 | 46 |
|
32 | 47 | func Push(in *jobsv1.PushRequest, out *jobsv1.Empty) error { |
33 | 48 | return nil |
34 | 49 | } |
35 | 50 | ``` |
36 | 51 |
|
37 | | -# Centrifugal API |
38 | | -- [API](https://github.com/centrifugal/centrifugo/blob/master/internal/apiproto/api.proto) |
39 | | -- [Proxy](https://github.com/centrifugal/centrifugo/blob/master/internal/proxyproto/proxy.proto) |
| 52 | +## Auto-generation |
| 53 | + |
| 54 | +Pushing to `master` in this repo triggers a GitHub Actions workflow in [`api-go`](https://github.com/roadrunner-server/api-go) that: |
| 55 | +1. Pulls the latest proto definitions via a git submodule. |
| 56 | +2. Runs `buf generate` to produce Go code. |
| 57 | +3. Commits and pushes the result. |
| 58 | + |
| 59 | +You do not need to run code generation manually — CI handles it automatically. |
40 | 60 |
|
41 | | -# Building API |
| 61 | +## Local development |
42 | 62 |
|
43 | | -- Install buf: `go install github.com/bufbuild/buf/cmd/buf@latest`. |
44 | | -- In the repository root run: `buf generate --debug` |
| 63 | +Install [Buf](https://buf.build/docs/installation): |
| 64 | +```bash |
| 65 | +go install github.com/bufbuild/buf/cmd/buf@latest |
| 66 | +``` |
| 67 | + |
| 68 | +Lint proto files: |
| 69 | +```bash |
| 70 | +buf lint |
| 71 | +``` |
| 72 | + |
| 73 | +Generate code locally (output goes to `build/`): |
| 74 | +```bash |
| 75 | +buf generate |
| 76 | +``` |
| 77 | + |
| 78 | +## Centrifugal API |
| 79 | +- [API](https://github.com/centrifugal/centrifugo/blob/master/internal/apiproto/api.proto) |
| 80 | +- [Proxy](https://github.com/centrifugal/centrifugo/blob/master/internal/proxyproto/proxy.proto) |
0 commit comments