Skip to content

Commit

Permalink
Merge pull request #206 from relab/Salhus/issue193/add-editions-support
Browse files Browse the repository at this point in the history
Added editions 2023 support with hybrid protobuf api
  • Loading branch information
meling authored Feb 3, 2025
2 parents 4107d6e + 00d8846 commit a29b7b1
Show file tree
Hide file tree
Showing 89 changed files with 1,147 additions and 1,262 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
- name: Install Protoc
uses: arduino/[email protected]
with:
version: "29.2"
include-pre-releases: true
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install tools
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
- name: Setup Protoc
uses: arduino/[email protected]
with:
version: "29.2"
include-pre-releases: true
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run Make
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dev: installgorums ordering/ordering.pb.go ordering/ordering_grpc.pb.go
@protoc -I=$(proto_path) \
--go_out=:. \
--gorums_out=dev=true:. \
--go_opt=default_api_level=API_OPAQUE \
$(zorums_proto)

benchmark: installgorums $(benchmark_deps)
Expand All @@ -29,7 +30,9 @@ $(static_file): $(static_files)
@protoc-gen-gorums --bundle=$(static_file)

%.pb.go : %.proto
@protoc -I=$(proto_path) --go_out=paths=source_relative:. $^
@protoc -I=$(proto_path) \
--go_opt=default_api_level=API_OPAQUE \
--go_out=paths=source_relative:. $^

%_grpc.pb.go : %.proto
@protoc -I=$(proto_path) --go-grpc_out=paths=source_relative:. $^
Expand Down
2 changes: 1 addition & 1 deletion async.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type asyncCallState struct {
// This function should only be used by generated code.
func (c RawConfiguration) AsyncCall(ctx context.Context, d QuorumCallData) *Async {
expectedReplies := len(c)
md := &ordering.Metadata{MessageID: c.getMsgID(), Method: d.Method}
md := ordering.Metadata_builder{MessageID: c.getMsgID(), Method: d.Method}.Build()
replyChan := make(chan response, expectedReplies)

for _, n := range c {
Expand Down
22 changes: 11 additions & 11 deletions benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type (
func runQCBenchmark(opts Options, cfg *Configuration, f qcFunc) (*Result, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
msg := &Echo{Payload: make([]byte, opts.Payload)}
msg := Echo_builder{Payload: make([]byte, opts.Payload)}.Build()
s := &Stats{}
var g errgroup.Group

Expand Down Expand Up @@ -97,7 +97,7 @@ func runQCBenchmark(opts Options, cfg *Configuration, f qcFunc) (*Result, error)
if err != nil {
return nil, err
}
result.ServerStats = memStats.MemoryStats
result.SetServerStats(memStats.GetMemoryStats())
}

return result, nil
Expand All @@ -106,7 +106,7 @@ func runQCBenchmark(opts Options, cfg *Configuration, f qcFunc) (*Result, error)
func runAsyncQCBenchmark(opts Options, cfg *Configuration, f asyncQCFunc) (*Result, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
msg := &Echo{Payload: make([]byte, opts.Payload)}
msg := Echo_builder{Payload: make([]byte, opts.Payload)}.Build()
s := &Stats{}
var g errgroup.Group

Expand Down Expand Up @@ -181,7 +181,7 @@ func runAsyncQCBenchmark(opts Options, cfg *Configuration, f asyncQCFunc) (*Resu
if err != nil {
return nil, err
}
result.ServerStats = memStats.MemoryStats
result.SetServerStats(memStats.GetMemoryStats())
}

return result, nil
Expand All @@ -197,7 +197,7 @@ func runServerBenchmark(opts Options, cfg *Configuration, f serverFunc) (*Result

benchmarkFunc := func(stopTime time.Time) {
for !time.Now().After(stopTime) {
msg := &TimedMsg{SendTime: time.Now().UnixNano(), Payload: payload}
msg := TimedMsg_builder{SendTime: time.Now().UnixNano(), Payload: payload}.Build()
f(ctx, msg)
}
}
Expand Down Expand Up @@ -232,11 +232,11 @@ func runServerBenchmark(opts Options, cfg *Configuration, f serverFunc) (*Result
return nil, err
}

clientAllocs := (end.Mallocs - start.Mallocs) / resp.TotalOps
clientMem := (end.TotalAlloc - start.TotalAlloc) / resp.TotalOps
clientAllocs := (end.Mallocs - start.Mallocs) / resp.GetTotalOps()
clientMem := (end.TotalAlloc - start.TotalAlloc) / resp.GetTotalOps()

resp.AllocsPerOp = clientAllocs
resp.MemPerOp = clientMem
resp.SetAllocsPerOp(clientAllocs)
resp.SetMemPerOp(clientMem)
return resp, nil
}

Expand Down Expand Up @@ -279,9 +279,9 @@ func RunBenchmarks(benchRegex *regexp.Regexp, options Options, cfg *Configuratio
if err != nil {
return nil, err
}
result.Name = b.Name
result.SetName(b.Name)
i := sort.Search(len(results), func(i int) bool {
return results[i].Name >= result.Name
return results[i].GetName() >= result.GetName()
})
results = append(results, nil)
copy(results[i+1:], results[i:])
Expand Down
Loading

0 comments on commit a29b7b1

Please sign in to comment.