Skip to content

Envelope rework#51

Merged
matburt merged 9 commits intoproject-receptor:masterfrom
jhjaggars:envelope-rework
Nov 22, 2019
Merged

Envelope rework#51
matburt merged 9 commits intoproject-receptor:masterfrom
jhjaggars:envelope-rework

Conversation

@jhjaggars
Copy link
Copy Markdown
Member

This PR decouples the routing information from the payload to allow for handling large payloads.

The general idea is to break the outer and inner envelope idea into two sequential parts, a header and a payload. Each section is preceded with Frame data that contains the message id and frame offset, as well as the length of the data to follow.

Currently, the Header contains the sender, recipient, and list of nodes already traveled. The idea is to read this into memory every time so that if the message needs to be routed we can do so without loading the entire payload into memory.

The payload is entirely arbitrary, but in practice will be encrypted data, and enough metadata to verify that the payload was actually destined for the node claimed by the header.

@jhjaggars jhjaggars requested a review from matburt November 20, 2019 04:01
@jhjaggars jhjaggars self-assigned this Nov 20, 2019
@jhjaggars jhjaggars force-pushed the envelope-rework branch 3 times, most recently from 02cbee1 to ca5bbd9 Compare November 21, 2019 17:29
@jhjaggars jhjaggars marked this pull request as ready for review November 21, 2019 22:45
FramedBuffer encapsulates handling of the new message format.

Essentially there are 1 or 2 frames that constitute a message.

[Header Frame][Header Body][Payload Frame][Payload]

or

[Command Frame][Command Body]

Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
1. too much data
2. not enough data

For project-receptor#1 we make sure we read no more than `to_read` in any given consume
operation.

For project-receptor#2 we make sure we have enough bytes on hand to unpack into a Frame,
buffering if we don't.

Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
@matburt matburt merged commit f64096c into project-receptor:master Nov 22, 2019
@jhjaggars jhjaggars deleted the envelope-rework branch November 22, 2019 14:08
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.

2 participants