Skip to content

Commit 1a3fc0a

Browse files
committed
protobuf: remove gogoproto
Remove gogoproto in favor of the standard protobuf compiler. This removes any nonstandard extensions that were part of gogoproto such as the custom types. Signed-off-by: Jonathan A. Sternberg <[email protected]>
1 parent 0752b3f commit 1a3fc0a

File tree

372 files changed

+22726
-75692
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

+22726
-75692
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
}

api/services/control/control_bench_test.go

+23-21
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66

77
digest "github.com/opencontainers/go-digest"
88
"github.com/stretchr/testify/require"
9+
"google.golang.org/protobuf/proto"
10+
"google.golang.org/protobuf/types/known/timestamppb"
911
)
1012

1113
// Buf is used to prevent the benchmark from being optimized away.
@@ -15,7 +17,7 @@ func BenchmarkMarshalVertex(b *testing.B) {
1517
v := sampleVertex()
1618
for i := 0; i < b.N; i++ {
1719
var err error
18-
Buf, err = v.Marshal()
20+
Buf, err = proto.Marshal(v)
1921
require.NoError(b, err)
2022
}
2123
}
@@ -24,7 +26,7 @@ func BenchmarkMarshalVertexStatus(b *testing.B) {
2426
v := sampleVertexStatus()
2527
for i := 0; i < b.N; i++ {
2628
var err error
27-
Buf, err = v.Marshal()
29+
Buf, err = proto.Marshal(v)
2830
require.NoError(b, err)
2931
}
3032
}
@@ -33,7 +35,7 @@ func BenchmarkMarshalVertexLog(b *testing.B) {
3335
v := sampleVertexLog()
3436
for i := 0; i < b.N; i++ {
3537
var err error
36-
Buf, err = v.Marshal()
38+
Buf, err = proto.Marshal(v)
3739
require.NoError(b, err)
3840
}
3941
}
@@ -42,11 +44,11 @@ var VertexOutput Vertex
4244

4345
func BenchmarkUnmarshalVertex(b *testing.B) {
4446
v := sampleVertex()
45-
buf, err := v.Marshal()
47+
buf, err := proto.Marshal(v)
4648
require.NoError(b, err)
4749

4850
for i := 0; i < b.N; i++ {
49-
err := VertexOutput.Unmarshal(buf)
51+
err := proto.Unmarshal(buf, &VertexOutput)
5052
require.NoError(b, err)
5153
}
5254
}
@@ -55,11 +57,11 @@ var VertexStatusOutput VertexStatus
5557

5658
func BenchmarkUnmarshalVertexStatus(b *testing.B) {
5759
v := sampleVertexStatus()
58-
buf, err := v.Marshal()
60+
buf, err := proto.Marshal(v)
5961
require.NoError(b, err)
6062

6163
for i := 0; i < b.N; i++ {
62-
err := VertexStatusOutput.Unmarshal(buf)
64+
err := proto.Unmarshal(buf, &VertexStatusOutput)
6365
require.NoError(b, err)
6466
}
6567
}
@@ -68,11 +70,11 @@ var VertexLogOutput VertexLog
6870

6971
func BenchmarkUnmarshalVertexLog(b *testing.B) {
7072
v := sampleVertexLog()
71-
buf, err := v.Marshal()
73+
buf, err := proto.Marshal(v)
7274
require.NoError(b, err)
7375

7476
for i := 0; i < b.N; i++ {
75-
err := VertexLogOutput.Unmarshal(buf)
77+
err := proto.Unmarshal(buf, &VertexLogOutput)
7678
require.NoError(b, err)
7779
}
7880
}
@@ -81,14 +83,14 @@ func sampleVertex() *Vertex {
8183
now := time.Now()
8284
started := now.Add(-time.Minute)
8385
return &Vertex{
84-
Digest: digest.FromString("abc"),
85-
Inputs: []digest.Digest{
86-
digest.FromString("dep1"),
87-
digest.FromString("dep2"),
86+
Digest: string(digest.FromString("abc")),
87+
Inputs: []string{
88+
string(digest.FromString("dep1")),
89+
string(digest.FromString("dep2")),
8890
},
8991
Name: "abc",
90-
Started: &started,
91-
Completed: &now,
92+
Started: timestamppb.New(started),
93+
Completed: timestamppb.New(now),
9294
}
9395
}
9496

@@ -97,21 +99,21 @@ func sampleVertexStatus() *VertexStatus {
9799
started := now.Add(-time.Minute)
98100
return &VertexStatus{
99101
ID: "abc",
100-
Vertex: digest.FromString("abc"),
102+
Vertex: string(digest.FromString("abc")),
101103
Name: "abc",
102104
Current: 1024,
103105
Total: 1024,
104-
Timestamp: now,
105-
Started: &started,
106-
Completed: &now,
106+
Timestamp: timestamppb.New(now),
107+
Started: timestamppb.New(started),
108+
Completed: timestamppb.New(now),
107109
}
108110
}
109111

110112
func sampleVertexLog() *VertexLog {
111113
now := time.Now()
112114
return &VertexLog{
113-
Vertex: digest.FromString("abc"),
114-
Timestamp: now,
115+
Vertex: string(digest.FromString("abc")),
116+
Timestamp: timestamppb.New(now),
115117
Stream: 1,
116118
Msg: []byte("this is a log message"),
117119
}

0 commit comments

Comments
 (0)