Skip to content

Commit 00c5f6e

Browse files
authored
Merge pull request #5342 from jsternberg/gogoproto-remove
protobuf: remove gogoproto
2 parents b82235c + 1a3fc0a commit 00c5f6e

File tree

372 files changed

+22885
-75664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

372 files changed

+22885
-75664
lines changed

api/services/control/control.pb.go

+2,300-10,696
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/services/control/control.proto

+25-28
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ syntax = "proto3";
22

33
package moby.buildkit.v1;
44

5+
option go_package = "github.com/moby/buildkit/api/services/control;moby_buildkit_v1";
6+
57
// import "github.com/containerd/containerd/api/types/descriptor.proto";
6-
import "github.com/gogo/googleapis/google/rpc/status.proto";
7-
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
88
import "github.com/moby/buildkit/api/types/worker.proto";
99
import "github.com/moby/buildkit/solver/pb/ops.proto";
1010
import "github.com/moby/buildkit/sourcepolicy/pb/policy.proto";
1111
import "google/protobuf/timestamp.proto";
12-
13-
option (gogoproto.sizer_all) = true;
14-
option (gogoproto.marshaler_all) = true;
15-
option (gogoproto.unmarshaler_all) = true;
12+
import "google/rpc/status.proto";
1613

1714
service Control {
1815
rpc DiskUsage(DiskUsageRequest) returns (DiskUsageResponse);
@@ -30,11 +27,11 @@ service Control {
3027
message PruneRequest {
3128
repeated string filter = 1;
3229
bool all = 2;
33-
int64 keepDuration = 3 [(gogoproto.nullable) = true];
30+
int64 keepDuration = 3;
3431

35-
int64 minStorage = 5 [(gogoproto.nullable) = true];
36-
int64 maxStorage = 4 [(gogoproto.nullable) = true];
37-
int64 free = 6 [(gogoproto.nullable) = true];
32+
int64 minStorage = 5;
33+
int64 maxStorage = 4;
34+
int64 free = 6;
3835
}
3936

4037
message DiskUsageRequest {
@@ -51,8 +48,8 @@ message UsageRecord {
5148
bool InUse = 3;
5249
int64 Size = 4;
5350
string Parent = 5 [deprecated=true];
54-
google.protobuf.Timestamp CreatedAt = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
55-
google.protobuf.Timestamp LastUsedAt = 7 [(gogoproto.stdtime) = true];
51+
google.protobuf.Timestamp CreatedAt = 6;
52+
google.protobuf.Timestamp LastUsedAt = 7;
5653
int64 UsageCount = 8;
5754
string Description = 9;
5855
string RecordType = 10;
@@ -71,8 +68,8 @@ message SolveRequest {
7168
string Session = 5;
7269
string Frontend = 6;
7370
map<string, string> FrontendAttrs = 7;
74-
CacheOptions Cache = 8 [(gogoproto.nullable) = false];
75-
repeated string Entitlements = 9 [(gogoproto.customtype) = "github.com/moby/buildkit/util/entitlements.Entitlement" ];
71+
CacheOptions Cache = 8;
72+
repeated string Entitlements = 9;
7673
map<string, pb.Definition> FrontendInputs = 10;
7774
bool Internal = 11; // Internal builds are not recorded in build history
7875
moby.buildkit.v1.sourcepolicy.Policy SourcePolicy = 12;
@@ -123,36 +120,36 @@ message StatusResponse {
123120
}
124121

125122
message Vertex {
126-
string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
127-
repeated string inputs = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
123+
string digest = 1;
124+
repeated string inputs = 2;
128125
string name = 3;
129126
bool cached = 4;
130-
google.protobuf.Timestamp started = 5 [(gogoproto.stdtime) = true ];
131-
google.protobuf.Timestamp completed = 6 [(gogoproto.stdtime) = true ];
127+
google.protobuf.Timestamp started = 5;
128+
google.protobuf.Timestamp completed = 6;
132129
string error = 7; // typed errors?
133130
pb.ProgressGroup progressGroup = 8;
134131
}
135132

136133
message VertexStatus {
137134
string ID = 1;
138-
string vertex = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
135+
string vertex = 2;
139136
string name = 3;
140137
int64 current = 4;
141138
int64 total = 5;
142-
google.protobuf.Timestamp timestamp = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
143-
google.protobuf.Timestamp started = 7 [(gogoproto.stdtime) = true ];
144-
google.protobuf.Timestamp completed = 8 [(gogoproto.stdtime) = true ];
139+
google.protobuf.Timestamp timestamp = 6;
140+
google.protobuf.Timestamp started = 7;
141+
google.protobuf.Timestamp completed = 8;
145142
}
146143

147144
message VertexLog {
148-
string vertex = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
149-
google.protobuf.Timestamp timestamp = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
145+
string vertex = 1;
146+
google.protobuf.Timestamp timestamp = 2;
150147
int64 stream = 3;
151148
bytes msg = 4;
152149
}
153150

154151
message VertexWarning {
155-
string vertex = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
152+
string vertex = 1;
156153
int64 level = 2;
157154
bytes short = 3;
158155
repeated bytes detail = 4;
@@ -202,8 +199,8 @@ message BuildHistoryRecord {
202199
map<string, string> FrontendAttrs = 3;
203200
repeated Exporter Exporters = 4;
204201
google.rpc.Status error = 5;
205-
google.protobuf.Timestamp CreatedAt = 6 [(gogoproto.stdtime) = true];
206-
google.protobuf.Timestamp CompletedAt = 7 [(gogoproto.stdtime) = true];
202+
google.protobuf.Timestamp CreatedAt = 6;
203+
google.protobuf.Timestamp CompletedAt = 7;
207204
Descriptor logs = 8;
208205
map<string, string> ExporterResponse = 9;
209206
BuildResultInfo Result = 10;
@@ -231,7 +228,7 @@ message UpdateBuildHistoryResponse {}
231228

232229
message Descriptor {
233230
string media_type = 1;
234-
string digest = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
231+
string digest = 2;
235232
int64 size = 3;
236233
map<string, string> annotations = 5;
237234
}
+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
package moby_buildkit_v1 //nolint:revive
2+
3+
import (
4+
"testing"
5+
"time"
6+
7+
digest "github.com/opencontainers/go-digest"
8+
"github.com/stretchr/testify/require"
9+
"google.golang.org/protobuf/proto"
10+
"google.golang.org/protobuf/types/known/timestamppb"
11+
)
12+
13+
// Buf is used to prevent the benchmark from being optimized away.
14+
var Buf []byte
15+
16+
func BenchmarkMarshalVertex(b *testing.B) {
17+
v := sampleVertex()
18+
for i := 0; i < b.N; i++ {
19+
var err error
20+
Buf, err = proto.Marshal(v)
21+
require.NoError(b, err)
22+
}
23+
}
24+
25+
func BenchmarkMarshalVertexStatus(b *testing.B) {
26+
v := sampleVertexStatus()
27+
for i := 0; i < b.N; i++ {
28+
var err error
29+
Buf, err = proto.Marshal(v)
30+
require.NoError(b, err)
31+
}
32+
}
33+
34+
func BenchmarkMarshalVertexLog(b *testing.B) {
35+
v := sampleVertexLog()
36+
for i := 0; i < b.N; i++ {
37+
var err error
38+
Buf, err = proto.Marshal(v)
39+
require.NoError(b, err)
40+
}
41+
}
42+
43+
var VertexOutput Vertex
44+
45+
func BenchmarkUnmarshalVertex(b *testing.B) {
46+
v := sampleVertex()
47+
buf, err := proto.Marshal(v)
48+
require.NoError(b, err)
49+
50+
for i := 0; i < b.N; i++ {
51+
err := proto.Unmarshal(buf, &VertexOutput)
52+
require.NoError(b, err)
53+
}
54+
}
55+
56+
var VertexStatusOutput VertexStatus
57+
58+
func BenchmarkUnmarshalVertexStatus(b *testing.B) {
59+
v := sampleVertexStatus()
60+
buf, err := proto.Marshal(v)
61+
require.NoError(b, err)
62+
63+
for i := 0; i < b.N; i++ {
64+
err := proto.Unmarshal(buf, &VertexStatusOutput)
65+
require.NoError(b, err)
66+
}
67+
}
68+
69+
var VertexLogOutput VertexLog
70+
71+
func BenchmarkUnmarshalVertexLog(b *testing.B) {
72+
v := sampleVertexLog()
73+
buf, err := proto.Marshal(v)
74+
require.NoError(b, err)
75+
76+
for i := 0; i < b.N; i++ {
77+
err := proto.Unmarshal(buf, &VertexLogOutput)
78+
require.NoError(b, err)
79+
}
80+
}
81+
82+
func sampleVertex() *Vertex {
83+
now := time.Now()
84+
started := now.Add(-time.Minute)
85+
return &Vertex{
86+
Digest: string(digest.FromString("abc")),
87+
Inputs: []string{
88+
string(digest.FromString("dep1")),
89+
string(digest.FromString("dep2")),
90+
},
91+
Name: "abc",
92+
Started: timestamppb.New(started),
93+
Completed: timestamppb.New(now),
94+
}
95+
}
96+
97+
func sampleVertexStatus() *VertexStatus {
98+
now := time.Now()
99+
started := now.Add(-time.Minute)
100+
return &VertexStatus{
101+
ID: "abc",
102+
Vertex: string(digest.FromString("abc")),
103+
Name: "abc",
104+
Current: 1024,
105+
Total: 1024,
106+
Timestamp: timestamppb.New(now),
107+
Started: timestamppb.New(started),
108+
Completed: timestamppb.New(now),
109+
}
110+
}
111+
112+
func sampleVertexLog() *VertexLog {
113+
now := time.Now()
114+
return &VertexLog{
115+
Vertex: string(digest.FromString("abc")),
116+
Timestamp: timestamppb.New(now),
117+
Stream: 1,
118+
Msg: []byte("this is a log message"),
119+
}
120+
}

0 commit comments

Comments
 (0)