Skip to content

Commit ee0d372

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 89b9515 commit ee0d372

File tree

377 files changed

+22715
-75566
lines changed

Some content is hidden

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

377 files changed

+22715
-75566
lines changed

api/services/control/control.pb.go

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

api/services/control/control.proto

+23-26
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,8 +27,8 @@ service Control {
3027
message PruneRequest {
3128
repeated string filter = 1;
3229
bool all = 2;
33-
int64 keepDuration = 3 [(gogoproto.nullable) = true];
34-
int64 keepBytes = 4 [(gogoproto.nullable) = true];
30+
int64 keepDuration = 3;
31+
int64 keepBytes = 4;
3532
}
3633

3734
message DiskUsageRequest {
@@ -48,8 +45,8 @@ message UsageRecord {
4845
bool InUse = 3;
4946
int64 Size = 4;
5047
string Parent = 5 [deprecated=true];
51-
google.protobuf.Timestamp CreatedAt = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
52-
google.protobuf.Timestamp LastUsedAt = 7 [(gogoproto.stdtime) = true];
48+
google.protobuf.Timestamp CreatedAt = 6;
49+
google.protobuf.Timestamp LastUsedAt = 7;
5350
int64 UsageCount = 8;
5451
string Description = 9;
5552
string RecordType = 10;
@@ -68,8 +65,8 @@ message SolveRequest {
6865
string Session = 5;
6966
string Frontend = 6;
7067
map<string, string> FrontendAttrs = 7;
71-
CacheOptions Cache = 8 [(gogoproto.nullable) = false];
72-
repeated string Entitlements = 9 [(gogoproto.customtype) = "github.com/moby/buildkit/util/entitlements.Entitlement" ];
68+
CacheOptions Cache = 8;
69+
repeated string Entitlements = 9;
7370
map<string, pb.Definition> FrontendInputs = 10;
7471
bool Internal = 11; // Internal builds are not recorded in build history
7572
moby.buildkit.v1.sourcepolicy.Policy SourcePolicy = 12;
@@ -120,36 +117,36 @@ message StatusResponse {
120117
}
121118

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

133130
message VertexStatus {
134131
string ID = 1;
135-
string vertex = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
132+
string vertex = 2;
136133
string name = 3;
137134
int64 current = 4;
138135
int64 total = 5;
139-
google.protobuf.Timestamp timestamp = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
140-
google.protobuf.Timestamp started = 7 [(gogoproto.stdtime) = true ];
141-
google.protobuf.Timestamp completed = 8 [(gogoproto.stdtime) = true ];
136+
google.protobuf.Timestamp timestamp = 6;
137+
google.protobuf.Timestamp started = 7;
138+
google.protobuf.Timestamp completed = 8;
142139
}
143140

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

151148
message VertexWarning {
152-
string vertex = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
149+
string vertex = 1;
153150
int64 level = 2;
154151
bytes short = 3;
155152
repeated bytes detail = 4;
@@ -199,8 +196,8 @@ message BuildHistoryRecord {
199196
map<string, string> FrontendAttrs = 3;
200197
repeated Exporter Exporters = 4;
201198
google.rpc.Status error = 5;
202-
google.protobuf.Timestamp CreatedAt = 6 [(gogoproto.stdtime) = true];
203-
google.protobuf.Timestamp CompletedAt = 7 [(gogoproto.stdtime) = true];
199+
google.protobuf.Timestamp CreatedAt = 6;
200+
google.protobuf.Timestamp CompletedAt = 7;
204201
Descriptor logs = 8;
205202
map<string, string> ExporterResponse = 9;
206203
BuildResultInfo Result = 10;
@@ -228,7 +225,7 @@ message UpdateBuildHistoryResponse {}
228225

229226
message Descriptor {
230227
string media_type = 1;
231-
string digest = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
228+
string digest = 2;
232229
int64 size = 3;
233230
map<string, string> annotations = 5;
234231
}

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)