Skip to content

Commit f6ddebd

Browse files
committed
feat: buf support
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
1 parent bb0be68 commit f6ddebd

28 files changed

+67
-4215
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ generate-proto:
88
protoc -I./proto/jobs/v1 --go_out=./proto/jobs/v1 jobs.proto
99
protoc -I./proto/kv/v1 --go_out=./proto/kv/v1 kv.proto
1010
protoc -I./proto/websockets/v1 --go_out=./proto/websockets/v1 websockets.proto
11-
protoc -I./proto/cache/v1beta --go_out=./proto/cache/v1beta response.proto
11+
protoc -I./proto/cache/v1 --go_out=./proto/cache/v1 response.proto
1212
protoc -I./proto/http/v1beta --go_out=./proto/http/v1beta http.proto
1313
protoc -I./proto/service/v1 --go_out=./proto/service/v1 service.proto

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,26 @@ Here as you see, our `package foo` depends only on the `api` repository, thus yo
3737

3838
---
3939

40+
## ALL protobuf API located here: [Buf](https://buf.build/roadrunner-server/api)
41+
To install and use generated packages:
42+
```bash
43+
go get go.buf.build/protocolbuffers/go/roadrunner-server/api
44+
```
45+
4046
Proto API used for the external integrations for the RPC (mostly) or as the internal communications. For example:
4147

4248
```go
4349
package foo
4450

4551
import (
46-
jobsv1beta "github.com/roadrunner-server/api/v2/proto/jobs/v1beta"
52+
jobsv1 "go.buf.build/protocolbuffers/go/roadrunner-server/api"
4753
)
4854

49-
func Push(in *jobsv1beta.PushRequest, out *jobsv1beta.Empty) error {
55+
func Push(in *jobsv1.PushRequest, out *jobsv1.Empty) error {
5056
return nil
5157
}
5258
```
5359

5460
Here is the method used in the RR to accept the `Job` from the external system.
61+
62+
You may also navigate to the [`DOCS`](https://buf.build/roadrunner-server/api/docs) tab and inspect the full API.

buf.gen.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: v1
2+
3+
plugins:
4+
- name: go
5+
opt:
6+
- paths=source_relative
7+
out: proto
8+
9+
- name: go-grpc
10+
out: proto
11+
opt:
12+
- paths=source_relative
13+
- require_unimplemented_servers=false

buf.work.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: v1
2+
3+
directories:
4+
- proto

buf.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: v1
2+
name: buf.build/roadrunner-server/api
3+
deps:
4+
- buf.build/googleapis/googleapis
5+
6+
breaking:
7+
use:
8+
- FILE
9+
lint:
10+
use:
11+
- DEFAULT

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ require (
77
github.com/prometheus/client_golang v1.12.1
88
github.com/roadrunner-server/goridge/v3 v3.4.1
99
github.com/valyala/fasthttp v1.36.0
10+
go.buf.build/protocolbuffers/go/roadrunner-server/api v1.2.1
1011
go.uber.org/zap v1.21.0
11-
google.golang.org/protobuf v1.28.0
1212
)
1313

1414
require (
@@ -26,4 +26,5 @@ require (
2626
go.uber.org/atomic v1.9.0 // indirect
2727
go.uber.org/multierr v1.8.0 // indirect
2828
golang.org/x/sys v0.0.0-20220429121018-84afa8d3f7b3 // indirect
29+
google.golang.org/protobuf v1.28.0 // indirect
2930
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
213213
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
214214
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
215215
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
216+
go.buf.build/protocolbuffers/go/roadrunner-server/api v1.2.1 h1:hj0YSuHUwQoxjoarYjqSCx2Pxy/qndrtMQsA4y6W57k=
217+
go.buf.build/protocolbuffers/go/roadrunner-server/api v1.2.1/go.mod h1:iGiZ72YpQLUTuxA0Ynq5SQ9gcseK0Ny1bbVbA0sHdvU=
216218
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
217219
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
218220
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=

plugins/fasthttp/interface.go

Lines changed: 0 additions & 1 deletion
This file was deleted.

plugins/kv/interface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package kv
22

3-
import kvv1 "github.com/roadrunner-server/api/v2/proto/kv/v1"
3+
import kvv1 "go.buf.build/protocolbuffers/go/roadrunner-server/api/proto/kv/v1"
44

55
// Storage represents single abstract storage.
66
type Storage interface {

proto/cache/v1/response.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
syntax = "proto3";
2+
3+
package cache.v1;
4+
5+
message Response {
6+
bytes data = 1;
7+
uint64 code = 2;
8+
map<string, HeaderValue> headers = 3;
9+
string timestamp = 4;
10+
}
11+
12+
message HeaderValue {
13+
repeated string value = 1;
14+
}

proto/cache/v1beta/response.pb.go

Lines changed: 0 additions & 244 deletions
This file was deleted.

proto/cache/v1beta/response.proto

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
syntax = "proto3";
22

33
package cache.v1beta;
4-
option go_package = "./;cacheV1beta";
5-
64

75
message Response {
86
bytes data = 1;

0 commit comments

Comments
 (0)