-
Notifications
You must be signed in to change notification settings - Fork 0
[Draft]: NEX Service #5
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
Draft
jonbarrow
wants to merge
3
commits into
master
Choose a base branch
from
feat/nex-service
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package nex.v1; | ||
|
|
||
| message GetStatsRequest {} | ||
|
|
||
| message GetStatsResponse { | ||
| uint64 player_count = 1; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package nex.v1; | ||
|
|
||
| message KickUserAggressiveRequest { | ||
| uint64 pid = 1; | ||
| } | ||
|
|
||
| message KickUserAggressiveResponse {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package nex.v1; | ||
|
|
||
| message KickUserRequest { | ||
| uint64 pid = 1; | ||
| } | ||
|
|
||
| message KickUserResponse {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package nex.v1; | ||
|
|
||
| message KillUserConnectionRequest { | ||
| uint64 pid = 1; | ||
| } | ||
|
|
||
| message KillUserConnectionResponse {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package nex.v1; | ||
|
|
||
| import "nex/v1/get_stats_rpc.proto"; | ||
| import "nex/v1/kick_user_rpc.proto"; | ||
| import "nex/v1/kick_user_aggressive_rpc.proto"; | ||
| import "nex/v1/kill_user_connection_rpc.proto"; | ||
|
|
||
| service NEXServiceV1 { | ||
| rpc GetStats(GetStatsRequest) returns (GetStatsResponse) {} // This name kinda blows | ||
|
|
||
| // Remove a user gracefully using the built in DISCONNECT system | ||
| rpc KickUser(KickUserRequest) returns (KickUserResponse) {} | ||
|
|
||
| // Remove a user aggressively using methods like killing the internal RC4 stream along with graceful methods | ||
| rpc KickUserAggressive(KickUserAggressiveRequest) returns (KickUserAggressiveResponse) {} | ||
|
|
||
| // Remove a user by any means necessary | ||
| rpc KillUserConnection(KillUserConnectionRequest) returns (KillUserConnectionResponse) {} | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't necessary to add the
V1suffix to the service name since that is already handled by the package namenex.v1There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, gRPC differentiates services by their name. We just got lucky in the other services that we happened to rename them in their respective v2 updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The service name isn't relevant here, so long as the package name is updated. Let's look at an example from the Go account service:
The "v1" version (with package name
account) is located on"github.com/PretendoNetwork/grpc/go/account", and the server and client interfaces are prefixed with the service name:AccountClientThe v2 version (with package name
account.v2), however, is located on"github.com/PretendoNetwork/grpc/go/account/v2"and the server and client interfaces are prefixed with the new service name:AccountServiceClientEven if the service names were the same, they are still located at different scopes in code, so there isn't any issues with keeping the name as
NEXServiceacross versions, since the code for them would be stored at different locations and therefore they can't collision.In this case, the package name is the following:
grpc/protobufs/nex/v1/nex_service.proto
Line 3 in a312e2c
So there won't be any issues with keeping the service name the same as long as the package name is updated to v2 accordingly when needed
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was partially mistaken. gRPC uses both the service name and package name to create the identifiers (this can be seen in the account server, where our middleware checks path names and these path names include the service identifier. Examples being
/api.API/GetUserDataand/api.v2.ApiService/GetUserData), so the service name is still relevant, since it means we could keep everything under the same package but with different service names, or we could use different packages (like what we do now) with the same package namesThat being said, I still believe it's good to version the service name as well for cases where we need to support multiple versions at the same time. The account server is a good recent example of that, where because we didn't version the service names and the names look so similar (
AccountDefinitionvsAccountServiceDefinition) it's hard to see at a glance what version each service is, resulting in code like:But if instead we had versioned the service names, we would not need for a namespace import: