-
Notifications
You must be signed in to change notification settings - Fork 4
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
Protobuf domains #280
Protobuf domains #280
Conversation
Right now I have the message subdomains in the same directory as the Do we want to keep the agent and client specific messages separate. group them like so we want to split the services into the domains as well? Currently the clientService is defined in |
75a3627
to
5e25cd9
Compare
Can you only copy in the google protos that we are actually using? For the google protos that we are not using, please delete them. Also on this MR in the description, you should describe the new structure. Use Also give some annotations explaining why you did what you did. As in put them where. |
Yea that's fine, but I wouldn't export this from `src/agent/index.ts`.
The `src/agent/index.ts` and `src/client/index.ts` should only export
what's in the local directory.
…On 11/1/21 4:00 PM, Brian Botha wrote:
***@***.**** commented on this pull request.
------------------------------------------------------------------------
In src/agent/agentPB.ts
<#280 (comment)>:
> @@ -0,0 +1,4 @@
+export * as common from '../proto/js/domains/Common_pb';
It's just to make it clearer in the code when using the messages. I
wanted to replicate the 'name spacing' so in the proto if the message
was defined in vaults EG |vaults.Vault| then we'd refer to it in the
code as |messages.vaults.Vault|.
It also allows us to import the messages from one place.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#280 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE4OHJWZEO77M5ONHRAEGLUJYNGDANCNFSM5G6GQRIQ>.
|
Oh, so you're saying I should import the agentPb directly instead of through the index.ts? |
Ok so I see what you did here...
When we start using these, we can copy just the ones we want to use. Which are all copied from: https://github.com/protocolbuffers/protobuf/tree/master/src/google/protobuf So atm, none of them are being used, so we can push that to later increment of the #275. |
I like the new structure. Now we can clearly see that |
I'm going to change it to The |
I noticed that Also because we are regenerating the code, we should be deleting the |
From #249 (comment) Because the package name is meant to follow the directory structure. It would mean that
Of course that would imply that we have 2 different versions. So instead we might do something like:
And instead of |
Also the package name should be the directory, but not contain the name of the file. This follows golang packaging/file hierarchy. |
This means all proto files part of the same package is part of the same namespace. So when referring to them, you just use |
Note that imports are all like this now:
Which means one has to refer to them using the full package name: |
Oh it seems you can use the same types within the same |
I see that the |
From a naming standard pov, the messages are more freeform. However specific kinds of messages should have Right now I need to ensure that all our types are not conflicting with each other. |
So we'll drop the |
Ok to preserve what @tegefaulkes did, I will instead do something like:
This means we have a package like That way it expands more cleanly and less need to to write the prefix/suffix within each file. |
Updated to:
|
The usage of For example if
But of course we should limit such changes, and try to make things as backwards compatible as possible. |
If I copy back in the google proto. There's actually some missing proto files. The original globbing wasn't working. So with the new globstar it is now working, so there's some extra google proto to bring in. By removing the
In case we need it for the future completion of #249. |
Now to update all the src code with the proper imports. |
7519d18
to
3844c8f
Compare
…t for `google.protobuf` message types. Fixes (#279)
3844c8f
to
f9fee2c
Compare
All code swapped over. Ran The last thing to do is to run tests. If the relevant tests pass for this, then merging time. All other MRs need to rebase on top. @emmacasolin can you help rebase the CLI retry MR https://gitlab.com/MatrixAI/Engineering/Polykey/js-polykey/-/merge_requests/213 cause this makes some big changes to the import paths. @scottmmorris you'll have to rebase for #266. |
All tests pass. Except of course for nodes being dealt with here #274. |
Description
This PR addresses changes relating to adding subdomains to the proto definitions and importing useful
google.protobuf
types.The new directory structure looks like this now. when using a message from a domain in a rpc you import it with
import "domains/vaults.proto"
and refer to the messages withdomains.vaults.Vault
.Issues Fixed
.proto
definition subdomains. #279Tasks
src/proto/schemas
, and integrate google's protobuf library by first referencing it and then just copying verbatimClient.proto
andAgent.proto
Final checklist