-
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
base: master
Are you sure you want to change the base?
Conversation
|
The latest Buf updates on your PR. Results from workflow Validate Pull Request / check_buf (pull_request).
|
|
Should we add protocol-specific methods here as well? Such as methods to get DataStore objects, and match session data, and rankings, etc? |
|
I think there should be services for each protocol, we'll probably have various methods on each protocol so I believe it's best to separate them to keep them organized |
| import "nex/v1/kick_user_aggressive_rpc.proto"; | ||
| import "nex/v1/kill_user_connection_rpc.proto"; | ||
|
|
||
| service NEXServiceV1 { |
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 V1 suffix to the service name since that is already handled by the package name nex.v1
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 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: AccountClient
The 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: AccountServiceClient
Even 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 NEXService across 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:
| package nex.v1; |
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
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/GetUserData and /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 names
That 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 (AccountDefinition vs AccountServiceDefinition) it's hard to see at a glance what version each service is, resulting in code like:
import { AccountDefinition as AccountServiceDefinitionV1 } from '@pretendonetwork/grpc/account/account_service';
import { AccountServiceDefinition as AccountServiceDefinitionV2 } from '@pretendonetwork/grpc/account/v2/account_service';But if instead we had versioned the service names, we would not need for a namespace import:
import { AccountServiceDefinitionV1 } from '@pretendonetwork/grpc/account/account_service';
import { AccountServiceDefinitionV2 } from '@pretendonetwork/grpc/account/v2/account_service';
That's fair, I agree. Do we want them in separate services entirely (IE, putting them at the top level of the protobufs Personally I'm leaning towards putting them inside the So we could have it structured like:
|
That sounds good to me! |
Resolves #XXX
Changes:
This is the start of a generic NEX service. Anything that we may want to do with, or get from, a game server should be implemented here. Currently using a PID size of uint64 because there's no reason not to in this case, it won't break anything and makes it forwards-compatible
Marked as a draft because this is very WIP. I'm not sure what all we think we might need out of this, and the design is subject to change at any time