Skip to content

Commit 253563d

Browse files
Request Fragmentation (rsocket#216)
Revision of how request fragmentation will be done with PAYLOAD frames as per discussion in rsocket/rsocket#198
1 parent e4c1184 commit 253563d

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Protocol.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,10 @@ PAYLOAD frames and all REQUEST frames may represent a large object and MAY need
895895

896896
Fragmentation does not change the request(n) or lease counts. In other words, a fragmented PAYLOAD frame counts as a single request(n) credit, and a request counts against a single lease count, regardless of how many fragments the frame is split into.
897897

898+
#### PAYLOAD Frame
899+
900+
When a PAYLOAD frame needs to be fragmented, a sequence of PAYLOAD frames is delivered using the (F)ollows flag.
901+
898902
When a PAYLOAD is fragmented, the Metadata MUST be transmitted completely before the Data.
899903

900904
For example, a single PAYLOAD with 20MB of Metdata and 25MB of Data that is fragmented into 3 frames:
@@ -927,6 +931,46 @@ Frame length = 13MB
927931
13MB of Data
928932
```
929933

934+
If the sender (Requester or Responder) wants to cancel sending a fragmented sequence, it MAY send a CANCEL frame without finishing delivery of the fragments.
935+
936+
#### REQUEST Frames
937+
938+
When REQUEST_RESPONSE, REQUEST_FNF, REQUEST_STREAM, or REQUEST_CHANNEL frames need to be fragmented, the first frame is the REQUEST_* frame with the (F)ollows flag set, followed by a sequence of PAYLOAD frames.
939+
940+
When fragmented, the Metadata MUST be transmitted completely before the Data.
941+
942+
For example, a single PAYLOAD with 20MB of Metdata and 25MB of Data that is fragmented into 3 frames:
943+
944+
```
945+
-- REQUEST_RESPONSE frame 1
946+
Frame length = 16MB
947+
(M)etadata present = 1
948+
(F)ollows = 1 (fragments coming)
949+
Metadata Length = 16MB
950+
951+
16MB of METADATA
952+
0MB of Data
953+
954+
-- PAYLOAD frame 2
955+
Frame length = 16MB
956+
(M)etadata present = 1
957+
(F)ollows = 1 (fragments coming)
958+
Metadata Length = 4MB
959+
960+
4MB of METADATA
961+
12MB of Data
962+
963+
-- PAYLOAD frame 3
964+
Frame length = 13MB
965+
(M)etadata present = 0
966+
(F)ollows = 0
967+
968+
0MB of METADATA
969+
13MB of Data
970+
```
971+
972+
If the Requester wants to cancel sending a fragmented sequence, it MAY send a CANCEL frame without finishing delivery of the fragments.
973+
930974
## Stream Sequences and Lifetimes
931975

932976
Streams exists for a specific period of time. So an implementation may assume that Stream IDs are valid for a finite period of time. This period of time is bound by either a) the lifetime of the underlying transport protocol connection, or b) the lifetime of a session if resumability is used to extend the session across multiple transport protocol connections. Beyond that, each interaction pattern imposes lifetime based on a sequence of interactions between Requester and Responder.

0 commit comments

Comments
 (0)