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

Add ADR for passthrough rpc #352

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add ADR for passthrough rpc #352

wants to merge 1 commit into from

Conversation

kpears201
Copy link
Collaborator

What

What does this PR add or remove?

Why

Why are these changes needed?

How

How do these changes achieve the goal?

Test

How has this been tested? How can a reviewer test it?

Checklist

  • I have self-reviewed this PR
  • I have added tests that prove the feature works or the fix is effective

### Correlation of Requests and Response from the passthrough provider

Since the jsonrpc id is also passed-through, how does Ripple know which id space the response is from?
For example, if app1 makes a "methodA" call with jsonrpc id=1 and app2 makes a "methodB" call also with jsonrpc id=1 and both are sent through the passthrough. When the response comes back with id=1, how does Ripple know the response is meant for app1 or app2.
Copy link
Collaborator

@satlead satlead Jan 3, 2024

Choose a reason for hiding this comment

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

Can we preload a correlationId similar to the provider broker into the __ctx. Correlation Id can map back to the connection id for the rpc router to send that back depending on the transport

Suggested change
For example, if app1 makes a "methodA" call with jsonrpc id=1 and app2 makes a "methodB" call also with jsonrpc id=1 and both are sent through the passthrough. When the response comes back with id=1, how does Ripple know the response is meant for app1 or app2.
"__ctx": {
"correlationId": uuid-uuid-uuid
"appId": "test.firecert"
}

Support config for Ripple in the device manifest file

```
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Feel we can reuse the connections and endpoints to suppport for multiple proxied rpc methods

Suggested change
{
{
"endpoints": {
"thunder" : {
"url": "ws://127.0.01:9992/jsonrpc",
"protocol": "websocket"
}
}

"passthrough_rpcs": [
{
"method": "device.model",
"url": "ws://127.0.0.1:9992/jsonrpc",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Schema can support either a url or a named enpoint as the above suggestion

If the message of the rpc method call is just a passthrough, should Ripple still do the argument validation?

#### Option 1: Ripple does the validation
Ripple can continue to do the validation, however currently the validation is done by the RPC handler when it deserialized the message into Rust structs. Passthrough providers should not reach Ripple handler code, and thus should not be deserialized.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Feel this should be part of the contract tests for the pass-through handler having Ripple doing the validation adds additional processing probably takes away some of the latency benefits expected from the passthrough operation.


#### Option 2: The provider does the validation
The provider already will need to deserialize the message, and thus can do the validation there. For example, if the spec says a field is a string but the client passed a boolean, it should fail to deserialize on the provider.
Down side is that the provider now need to implement all the boiler plate errors in the same way that is expected for any firebolt APIs. Each provider may implement it differently and not to spec.
Copy link
Collaborator

@satlead satlead Jan 3, 2024

Choose a reason for hiding this comment

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

Given Ripple still handles the checks for capabilities and grants error template will be reduced to the individual handler errors which probably needs definition as well in the open rpc.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

3 participants