-
Notifications
You must be signed in to change notification settings - Fork 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
Migrate all VaultsSecrets
handlers to RawHandler
#822
Comments
This needs to be weighed up against making the RPC too unique to our usecases and making it more difficult to use in other clients. |
Actually, not all This would be crucial, however, for |
Raw stream just means a json message initially and then just raw binary data afterwards. We don't have a trailing message protocol so it's easy. This also makes it possible to protocol matching, like enabling the ability to raw pipe binary data from the fs straight into the stream after the initial json message. |
This makes it far more efficient too. It was the original intention! |
Another point to note would be that error serialisation would be restricted. Normally, the regular streams would throw errors normally, and they would get caught by the RPC internals, get serialised, and sent over the RPC as JSON. Then, the other side will convert it back. For raw streams, however, if an error is thrown from inside the RPC, then it will hit the transport layer and bring down the entire connection with a To deal with this, we would need to do manual error serialisation/deserialisation, which is fine but it would restrict what errors we can send over. If we restrict the errors we can send over, then we are restricting the visibility of bugs. If an error happens on the handler, then instead of getting the error, we would get a |
If you want to send errors over the binary stream then we need to work out a protocol that can multiplex these errors over the stream. It would have to be implemented by a re-usable transform stream that handles it for us. |
Specification
Most, if not all,
VaultsSecrets
handlers transfer binary data. Doing so using plain JSON isn't the most efficient, as the required bandwidth can be as high as 200% of actual data size, making regular JSON extremely inefficient for transferring binary data.This is solved by the
RawHandler
, which is able to stream raw bytes of data directly, bypassing the large overhead. However, it also has many issues, like not supporting error serialisation by default. As such, any errors thrown within the context will hit the transport layer, causing aread 0
error.To solve this, each handler needs to implement its own method of error serialisation and deserialisation. The handler side needs to serialise the errors so they are passed through as binary data, and the client side needs to deserialise the data back into the original error. Serialising and deserialising all possible errors is not feasible, and should not be done either. Only create serialisation and deserialisation handlers for relevant errors that are expected, and raise a generic error for all other, unexpected errors.
Additional context
Tasks
RawHandler
sVaultsSecretsCat
VaultsSecretsWrite
VaultsSecretsCopy
VaultsSecretsMove
The text was updated successfully, but these errors were encountered: