Skip to content

RPC Raw Streams for Binary Data #2

@tegefaulkes

Description

@tegefaulkes

Specification

RPC methods that need to send binary data such as secrets data for the client RPC or GIT pack data for the agent RPC. This needs to make use of the raw streams in the RPC system.

Raw streams take a header message and then act as a normal binary stream. The header can include any metadata you need. The binary data can then be streamed. To ensure there are no problems with Endianness we can chunk the data into protobuf messages.

Some things to note

  1. Raw streams don't have a return header message/metadata currently. It could be implemented.
  2. Raw streams don't support middleware.
  3. If we use protobuf messages then we need a standard way of delimiting messages in the stream.

See #2 for clarification on the usage of binary data formats like CBOR or Protobuf. It's only needed in limited usecases, and can be done as part of the RPC caller and handler.

When dropping to raw streams there should still be an exchange protocol between client and server.

The client sends a "header" message, and then should expect the server to send back a "header" message. Both should be in JSON. Only then the client can drop down to binary. However this can be just one of the ways of using it. This primarily applies to streaming: client streaming, server streaming and duplex streaming.

For example:

  • In client streaming, the client sends 1 header message, then starts sending binary data. The server then sends back a JSON message (possibly at the end or at any time?)
  • In server streaming, the client sends 1 header message, the server send backs 1 header message, then drops down to binary.
  • In duplex streaming. The client sends a header message. The server responds with a header message. Both client and server can start sending binary data (at any time?).

It seems we should enforce that there be a header message sent, even if it is empty like a {}.

Additional context

Tasks

  1. Spec out a standard way of sending raw file/binary data.
  2. Update all relevant handlers to use raw streaming for sending this data.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions