Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Sidecar and upgrade Pitaya to v3 #287

Open
wants to merge 96 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
dc45a18
BeforeHandler return context
codingcn Dec 14, 2020
9943b0b
fix BeforeHandler.Handlers res
Dec 15, 2020
2b1b9ff
fix TestBeforeHandler test
Dec 16, 2020
d2bb5f0
Migrate from Travis CI to Github Actions (#159)
victor-carvalho Jan 6, 2021
053dc61
Update go version
victor-carvalho Jan 7, 2021
d062a17
Update dependencies (#161)
victor-carvalho Jan 13, 2021
3ac8d06
Update several libraries and dependencies
rsafonseca Mar 20, 2021
d9ceab8
fix make setup, broken since 1.1.5
rsafonseca Mar 20, 2021
f16dfdd
Prevent gigantic flood of error messages when etcd channel dies
rsafonseca Mar 21, 2021
370d7ce
update test libs
rsafonseca Mar 21, 2021
d28ae61
update more libs
rsafonseca Mar 21, 2021
3328b0e
Add 2 tests to statsd metrics
rsafonseca Mar 21, 2021
6662b35
Fix session test after nats-2.0 server upgrade in helpers
rsafonseca Mar 22, 2021
ae67201
fix cluster tests
rsafonseca Mar 22, 2021
506edba
fix service test
rsafonseca Mar 22, 2021
371658f
Fix remaining tests
rsafonseca Mar 22, 2021
fd9cf18
Remove accidental file addition
rsafonseca Mar 22, 2021
a0958fc
Fix error assertion
rsafonseca Mar 22, 2021
bb02946
Merge pull request #170 from topfreegames/update_deps
rsafonseca Mar 22, 2021
a94883f
Fix error check in test
rsafonseca Mar 23, 2021
8251063
Recover service discovery from etcd client channels closing
rsafonseca Mar 23, 2021
930e1d4
Revert "Fix tests (#154)"
rsafonseca Mar 24, 2021
41329c3
Revert to returning original error object
rsafonseca Mar 24, 2021
22e4a99
Don't try to initialize real client during test
rsafonseca Mar 24, 2021
85893ce
Add RPC type info to spans
rsafonseca Mar 24, 2021
e487b30
Don't log nats URL on reconnect since it contains credentials when us…
rsafonseca Mar 24, 2021
dbfae28
Drain NATS server connections instead of closing directly
rsafonseca Mar 24, 2021
177cdf3
Merge pull request #172 from topfreegames/fixbugs
rsafonseca Mar 24, 2021
60c9f16
Use single get on syncservers and parallelise parsing only
rsafonseca Apr 26, 2021
540d51f
Run gofmt on changed files
rsafonseca Apr 26, 2021
150c31e
Only get full payload on server initialization
rsafonseca Apr 26, 2021
5ae9a55
Add logging for syncservers time, change syncservers timing on flaky …
rsafonseca Apr 26, 2021
761010f
Log error if etcd get fails
rsafonseca Apr 26, 2021
d5a0dc1
Merge pull request #184 from topfreegames/fix_syncservers
rsafonseca Apr 26, 2021
e68a52d
Only advertise server once initial sync is finished
rsafonseca Apr 26, 2021
68eb508
Adopting new project structure
felipejfc Apr 23, 2021
326aed0
Update more dependencies and fix tests
felipejfc Apr 24, 2021
70a97bd
update readme
felipejfc Apr 24, 2021
b0bc848
fix example project
felipejfc Apr 24, 2021
71fcfe2
remove binaries
felipejfc Apr 25, 2021
19867ca
add build folder to gitignore
felipejfc Apr 25, 2021
4738469
WIP sidecar implementation
felipejfc Apr 26, 2021
7e0b287
SyncServers duration log to debug
felipejfc Apr 28, 2021
6589654
Only set RPCServer pitayaServer if there's none set yet
felipejfc Apr 30, 2021
a8689de
Add RawRPC api method
felipejfc Apr 30, 2021
e8cabd6
Add bin and obj to gitignore
felipejfc Apr 30, 2021
4d9129c
Add a GetPitayaServer interface method to RPCServer and update mocks
felipejfc Apr 30, 2021
c3fc8b3
Update benchmark protos
felipejfc May 4, 2021
d8e9e21
Update examples with updated protobuf
felipejfc May 4, 2021
b0ac57f
Add benchmark example project
felipejfc May 4, 2021
63aa393
Solve some TODOs in the sidecar
felipejfc May 11, 2021
b3ba705
update protobuf generated files
felipejfc May 11, 2021
9f8ea2c
update config and constant errors
felipejfc May 11, 2021
5eb2c42
add debug to benchmark project
felipejfc May 20, 2021
9e0e979
remove unnecessary TODO
felipejfc May 20, 2021
bd2b139
update pitaya-protos
felipejfc May 20, 2021
575c4ad
update proto generated files
felipejfc May 20, 2021
2abc080
fix RPC sending from sidecar client
felipejfc May 20, 2021
83cccc5
can run cluster_protobuf example with both tcp and ws acceptors
felipejfc May 20, 2021
633cc2c
Merge pitaya-cli with this project
felipejfc May 21, 2021
e02c75e
fix bug where a notify route would crash the cli
felipejfc May 21, 2021
e701ab2
Fix crash on unexpected push
felipejfc May 21, 2021
e186ebc
add docs as a common handler
felipejfc Jun 9, 2021
473d59c
add an additional session test
felipejfc Jun 9, 2021
6ec385c
update protobuf generated files
felipejfc Jul 23, 2021
91952b6
enrich gitignore
felipejfc Jul 23, 2021
f5997f7
Update the pitaya-protos submodule
felipejfc Jul 23, 2021
38a2b6f
update the example sidecar project
felipejfc Jul 23, 2021
ef470d3
add new error and validation in session setData
felipejfc Jul 23, 2021
f5cc86c
Merge with the C# lib, add Push and Kick support to the sidecar
felipejfc Jul 23, 2021
8a69195
add go sidecar documentation
felipejfc Jul 23, 2021
ba64e2f
Add new GetServer route to the sidecar
felipejfc Jul 23, 2021
2f26668
[WIP] feat: add service discovery capabilities to the sidecar
felipejfc Jul 27, 2021
e73f342
Support UDS in Windows
felipejfc Jul 28, 2021
3bd09f0
upgrade grpc dependency, makefile more windows-friendly
felipejfc Jul 28, 2021
f0226cc
Rollback target to netstandard2.0
felipejfc Jul 29, 2021
df7f3b8
fix program.cs initialization
felipejfc Jul 29, 2021
6c6cd2d
feat: reimplemented service discovery callbacks
felipejfc Aug 16, 2021
c47a46c
feat: restored graceful shutdown capabilities
felipejfc Aug 18, 2021
3fc4bdb
update pitaya-protos
felipejfc Aug 31, 2021
9611aa4
remove unnecessary comment
felipejfc Aug 31, 2021
547b53d
feat: configuration with environment variables
felipejfc Aug 31, 2021
bfeb506
wip feat: jaeger tracing for sidecar
felipejfc Oct 31, 2021
ddd155b
Configuration in the sidecar, csharp examples, shutdown sidecar func…
felipejfc Nov 3, 2021
c60ef83
fix tracing logic
felipejfc Nov 4, 2021
23e1bf6
add csproj files to repo
felipejfc Jul 11, 2022
f0580d9
little improvements to proj
felipejfc Sep 12, 2022
2058e43
Merge Pitaya V2 into sidecar
GabrielBackes Sep 14, 2022
90b057b
Upgrade pitaya to V3
GabrielBackes Sep 26, 2022
f8fd0df
Merge sidecar into main
GabrielBackes Sep 26, 2022
2e8289d
Update pitaya mock
GabrielBackes Sep 29, 2022
93b3b9b
Add sidecar initialization with pitaya
GabrielBackes Oct 5, 2022
6939cf2
NPitayaSidecar
GabrielBackes Oct 7, 2022
22822ab
Add Prometheus
GabrielBackes Oct 20, 2022
79eeb22
Add ServiceProvider to Handlers/Remotes initialization
GabrielBackes Oct 26, 2022
db4e69a
Refactor pitaya cluster initialization
GabrielBackes Oct 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
79 changes: 79 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.so
*.dylib
*.PID
*.meta

# Test binary, build with `go test -c`
*.test
Expand All @@ -26,3 +27,81 @@ debug

examples/testing/server
examples/demo/cluster_grpc/main
build
bin
obj
out
.vs

# Unity 3D

# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "protos"]
[submodule "pitaya-protos"]
path = pitaya-protos
url = https://github.com/topfreegames/pitaya-protos
url = git@github.com:topfreegames/pitaya-protos.git
45 changes: 33 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
TESTABLE_PACKAGES = `go list ./... | grep -v examples | grep -v constants | grep -v mocks | grep -v helpers | grep -v interfaces | grep -v protos | grep -v e2e | grep -v benchmark`

ifeq ($(OS), Windows_NT)
BIN := pitaya.exe
MKFOLDER := if not exist "build" mkdir build
GREP_CMD := findstr /V
else
BIN := pitaya
MKFOLDER := mkdir -p build
GREP_CMD := grep -v
endif

TESTABLE_PACKAGES = $(shell go list ./... | $(GREP_CMD) examples | $(GREP_CMD) constants | $(GREP_CMD) mocks | $(GREP_CMD) helpers | $(GREP_CMD) interfaces | $(GREP_CMD) protos | $(GREP_CMD) e2e | $(GREP_CMD) benchmark)

.PHONY: build

build:
@$(MKFOLDER)
@go build -o build/$(BIN)

setup: init-submodules
@go get ./...
Expand Down Expand Up @@ -55,8 +72,9 @@ protos-compile-demo:

protos-compile:
@cd benchmark/testdata && ./gen_proto.sh
@protoc -I pitaya-protos/ pitaya-protos/*.proto --go_out=plugins=grpc:protos
@protoc -I pitaya-protos/test pitaya-protos/test/*.proto --go_out=protos/test
@protoc -I pitaya-protos/ pitaya-protos/*.proto --go_out=./pkg/protos/ --go_opt paths=source_relative --go-grpc_out ./pkg/protos/ --go-grpc_opt paths=source_relative --go-grpc_opt require_unimplemented_servers=false
@protoc -I pitaya-protos/test pitaya-protos/test/*.proto --go_out ./pkg/protos/test/ --go_opt paths=source_relative
@protoc -I examples/demo/protos/ examples/demo/protos/*.proto --go_out ./examples/demo/protos --go_opt paths=source_relative

rm-test-temp-files:
@rm -f cluster/127.0.0.1* 127.0.0.1*
Expand Down Expand Up @@ -141,26 +159,29 @@ test-coverage-func coverage-func: test-coverage merge-profiles
@echo "\033[1;34m=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\033[0m"
@go tool cover -func=coverage-all.out | egrep -v "100.0[%]"

mocks: agent-mock session-mock networkentity-mock pitaya-mock serializer-mock metrics-mock acceptor-mock
mocks: agent-mock session-mock networkentity-mock pitaya-mock serializer-mock metrics-mock acceptor-mock cluster-mock

agent-mock:
@mockgen github.com/topfreegames/pitaya/v2/agent Agent,AgentFactory | sed 's/mock_agent/mocks/' > agent/mocks/agent.go
@mockgen github.com/topfreegames/pitaya/v3/pkg/agent Agent,AgentFactory | sed 's/mock_agent/mocks/' > pkg/agent/mocks/agent.go

session-mock:
@mockgen github.com/topfreegames/pitaya/v2/session Session,SessionPool | sed 's/mock_session/mocks/' > session/mocks/session.go
@mockgen github.com/topfreegames/pitaya/v3/pkg/session Session,SessionPool | sed 's/mock_session/mocks/' > pkg/session/mocks/session.go

networkentity-mock:
@mockgen github.com/topfreegames/pitaya/v2/networkentity NetworkEntity | sed 's/mock_networkentity/mocks/' > networkentity/mocks/networkentity.go
@mockgen github.com/topfreegames/pitaya/v3/pkg/networkentity NetworkEntitgit y | sed 's/mock_networkentity/mocks/' > pkg/networkentity/mocks/networkentity.go

pitaya-mock:
@mockgen github.com/topfreegames/pitaya/v2 Pitaya | sed 's/mock_v2/mocks/' > mocks/app.go
@mockgen github.com/topfreegames/pitaya/v3/pkg Pitaya | sed 's/mock_v2/mocks/' > pkg/mocks/app.go

metrics-mock:
@mockgen github.com/topfreegames/pitaya/v2/metrics Reporter | sed 's/mock_metrics/mocks/' > metrics/mocks/reporter.go
@mockgen github.com/topfreegames/pitaya/v2/metrics Client | sed 's/mock_metrics/mocks/' > metrics/mocks/statsd_reporter.go
@mockgen github.com/topfreegames/pitaya/v3/pkg/metrics Reporter | sed 's/mock_metrics/mocks/' > pkg/metrics/mocks/reporter.go
@mockgen github.com/topfreegames/pitaya/v3/pkg/metrics Client | sed 's/mock_metrics/mocks/' > pkg/metrics/mocks/statsd_reporter.go

serializer-mock:
@mockgen github.com/topfreegames/pitaya/v2/serialize Serializer | sed 's/mock_serialize/mocks/' > serialize/mocks/serializer.go
@mockgen github.com/topfreegames/pitaya/v3/pkg/serialize Serializer | sed 's/mock_serialize/mocks/' > pkg/serialize/mocks/serializer.go

acceptor-mock:
@mockgen github.com/topfreegames/pitaya/v2/acceptor PlayerConn,Acceptor | sed 's/mock_acceptor/mocks/' > mocks/acceptor.go
@mockgen github.com/topfreegames/pitaya/v3/pkg/acceptor PlayerConn,Acceptor | sed 's/mock_acceptor/mocks/' > pkg/mocks/acceptor.go

cluster-mock:
@mockgen github.com/topfreegames/pitaya/v3/pkg/cluster RPCServer,RPCClient,SDListener,RemoteBindingListener,InfoRetriever | sed 's/mock_cluster/mocks/' > pkg/cluster/mocks/cluster.go
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ This command will run both unit and e2e tests.
#TODO

## Authors
* **TFG Co** - Initial work
* **Wildlife Studios** - Initial work

## License
[MIT License](./LICENSE)
Expand Down
8 changes: 4 additions & 4 deletions agent/mocks/agent.go

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

2 changes: 1 addition & 1 deletion benchmark/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ package benchmark

import (
"fmt"
"github.com/topfreegames/pitaya/v3/pkg/client"
"os"
"testing"

"github.com/sirupsen/logrus"
"github.com/topfreegames/pitaya/v2/client"
)

var clients []*client.Client
Expand Down
2 changes: 1 addition & 1 deletion benchmark/testdata/gen_proto.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
protoc --go_out . *.proto
protoc --go_out=./ --go_opt=paths=source_relative *.proto
Loading