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

@xviz/server module #453

Merged
merged 35 commits into from May 23, 2019
Merged

@xviz/server module #453

merged 35 commits into from May 23, 2019

Conversation

twojtasz
Copy link
Contributor

Provide a full featured XVIZ server module that can full support the XVIZ protocol and allow customization

@coveralls
Copy link

coveralls commented May 15, 2019

Coverage Status

Coverage increased (+0.9%) to 76.005% when pulling fc7c356 on xviz-server-module into 17e89bb on xviz-io-module.

@twojtasz twojtasz changed the base branch from master to xviz-io-module May 15, 2019 20:33
@twojtasz twojtasz added this to the v1.0 milestone May 15, 2019
@twojtasz twojtasz mentioned this pull request May 17, 2019
31 tasks
Replace our adhoc server with a structured  middleware based implementation.

This server is setup to read from XVIZ Data Source to support any
source such as files or a runtime conversion from other formats.
We cannot send 'object' down a websocket.  The prior code was too
complicate and this is a simplification.

This will be codified in a test in a follow-up diff.
- Added test classes for server testing
- Broke out XVIZ message to middleware handling into a class
@twojtasz twojtasz requested a review from jlisee May 22, 2019 14:13
@jlisee jlisee mentioned this pull request May 23, 2019
Copy link
Contributor

@jlisee jlisee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These docs here are really great and complete! I have given read through the docs but need to do another pass on the code itself while referencing the docs to make sure I understand all the concepts. Can I want to have a glossary somewhere with all the main bits like:

  • Provider
  • Handler
  • Session
  • Middleware
  • ...

So the two overview images of IO and server are the best we have right now, but something really concise to jog my memory while reviewing the code would help.

docs/api-reference/server/xviz-server.md Outdated Show resolved Hide resolved
docs/api-reference/server/overview-handler.md Outdated Show resolved Hide resolved
docs/api-reference/server/xviz-server-middleware-stack.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jlisee jlisee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is super SOLID @twojtasz it took two monitors and a pinned octotree to review so much of it at once though.

The comment I have on the testing is that we might look at adding testing at lower levels eventually because right now we just have it at the server level, and we don't have any flow types on this either so it would be easy for bugs to creep in at that level (depending on how many paths the server level tests cover).

modules/server/src/server/xviz-provider-session.js Outdated Show resolved Hide resolved
this.options = options;
}

writeSync(name, data) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unused name parameter in this field is confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move the name to the send argument, that way it can be ignored by JS impl's that don't require it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this runs a bit deeper than I thought. The writeSync i related to the other write messages (specifically writeMetadata and writeFrame). Since we are changing the writeFrame => writeMessage I"ll make this related IO change in that PR

}
}

onTransformLogDone(msg) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it is weird that some of the message we send back and forth as GLB but some we always send as JSON.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should just do the same I do for onStateUpdate(msg) here. I'm cheating because this is a server generated msg but yeah, this is not robust.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curiously, in order to support the uniform handling of message I need the above writeMessage change :) The reason being is that this code is taking short cut by assuming it knows the data format and writing directly to the socket. The more uniform approach delegates the formatting issue to the writer. But the current IO interface has write functions only for Metadata and Frame. So this too will be in #454 which is turning out to be a very much needed correction on the API

@twojtasz
Copy link
Contributor Author

twojtasz commented May 23, 2019

This code is super SOLID @twojtasz it took two monitors and a pinned octotree to review so much of it at once though.

Yeah, definitely need to avoid the large commit and break out design way earlier. Sadly a lot of it was "discovered" only once I was working through the original server and never stopped to formalize the whole thing like I should have.

Thanks for slogging through it all!

@twojtasz twojtasz merged commit 92a5b6d into xviz-io-module May 23, 2019
twojtasz added a commit that referenced this pull request May 23, 2019
Proper module to replace our adhoc server script with a structured middleware-based implementation.

Key documents are:
 - RFC ./dev-docs/004-server-module-rfc.md
 - User Docs ./docs/api-reference/server
 - Module Readme ./modules/server/README.md
twojtasz added a commit that referenced this pull request May 23, 2019
Proper module to replace our adhoc server script with a structured middleware-based implementation.

Key documents are:
 - RFC ./dev-docs/004-server-module-rfc.md
 - User Docs ./docs/api-reference/server
 - Module Readme ./modules/server/README.md
@twojtasz twojtasz deleted the xviz-server-module branch September 5, 2019 05:17
alexhaislip pushed a commit to Smart-Ag/xviz that referenced this pull request Aug 2, 2021
Proper module to replace our adhoc server script with a structured middleware-based implementation.

Key documents are:
 - RFC ./dev-docs/004-server-module-rfc.md
 - User Docs ./docs/api-reference/server
 - Module Readme ./modules/server/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants