Skip to content

Commit

Permalink
change the protobuf package to google.golang.org/protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
gsw945 authored and lonng committed Jul 5, 2021
1 parent 7020ee1 commit 57f7ee2
Show file tree
Hide file tree
Showing 12 changed files with 1,983 additions and 766 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The Nano will remain simple, but you can perform any operations in the component

#### How to execute the asynchronous task

```go
```golang
func (manager *PlayerManager) Login(s *session.Session, msg *ReqPlayerLogin) error {
var onDBResult = func(player *Player) {
manager.players = append(manager.players, player)
Expand Down Expand Up @@ -102,24 +102,40 @@ func (manager *PlayerManager) Login(s *session.Session, msg *ReqPlayerLogin) err

## Installation

```shell
```bash
go get github.com/lonng/nano

# dependencies
go get -u github.com/golang/protobuf
go get -u github.com/pingcap/check
go get -u github.com/pingcap/errors
go get -u github.com/urfave/cli

go get -u google.golang.org/protobuf/proto
go get -u github.com/gorilla/websocket
go get -u google.golang.org/grpc
```

## Protocol Buffers
```bash
# protoc
# download form: https://github.com/protocolbuffers/protobuf/releases
# protoc-gen-go
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
```

## Benchmark

```shell
```bash
# Case: PingPong
# OS: Windows 10
# Device: i5-6500 3.2GHz 4 Core/1000-Concurrent   => IOPS 11W(Average)
# Other: ...

cd $GOPATH/src/github.com/lonng/nano/benchmark/io
go test -v -tags "benchmark"
go test -tags "benchmark" -v benchmark\io\io_test.go
```

## License
Expand Down
2 changes: 1 addition & 1 deletion benchmark/io/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
"net"
"sync"

"github.com/golang/protobuf/proto"
"github.com/lonng/nano/internal/codec"
"github.com/lonng/nano/internal/message"
"github.com/lonng/nano/internal/packet"
"google.golang.org/protobuf/proto"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion benchmark/testdata/gen_proto.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
protoc --go_out=. *.proto
protoc --go_opt=paths=source_relative --go_out=. --proto_path=. *.proto
225 changes: 175 additions & 50 deletions benchmark/testdata/test.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions benchmark/testdata/test.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
syntax = "proto3";
package testdata;
option go_package = "/testdata";

message Ping {
string Content = 1;
Expand Down
Loading

0 comments on commit 57f7ee2

Please sign in to comment.