Skip to content

Commit b0fd260

Browse files
authored
Fetch Objects if you can (#581)
Attempt to convert the consensus from the recent hybrid interim on October 2nd/3rd into a PR with the help of @suhasHere There's a lot more editorial cleanup to do, such as the priorities section, because many things now need to say "subscriptions or fetches", etc. It does not do some things we may want to do later: * add support for multiple ranges * add a FETCH_UPDATE * add a MAX_FETCH_ID or equivalent * Put fetches on their own **bidirectional** stream Fixes #350 Fixes #368 Fixes #476 Fixes #482 Fixes #490 Fixes #578
2 parents 1f4f152 + 6613d16 commit b0fd260

File tree

1 file changed

+228
-13
lines changed

1 file changed

+228
-13
lines changed

draft-ietf-moq-transport.md

Lines changed: 228 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ Given the critical nature of control messages and their relatively
621621
small size, the control stream SHOULD be prioritized higher than all
622622
subscribed Objects.
623623

624+
Both SUBSCRIBE and FETCH messages indicate a subscriber priority and
625+
group order, so the following text applies equally to both types of
626+
subscriptions.
627+
624628
The subscriber indicates the priority of a subscription via the
625629
Subscriber Priority field and the original publisher indicates priority
626630
in every stream or datagram header. As such, the subscriber's priority is a
@@ -957,6 +961,14 @@ MOQT Control Message {
957961
|-------|-----------------------------------------------------|
958962
| 0x15 | MAX_SUBSCRIBE_ID ({{message-max-subscribe-id}}) |
959963
|-------|-----------------------------------------------------|
964+
| 0x16 | FETCH ({{message-fetch}}) |
965+
|-------|-----------------------------------------------------|
966+
| 0x17 | FETCH_CANCEL ({{message-fetch-cancel}}) |
967+
|-------|-----------------------------------------------------|
968+
| 0x18 | FETCH_OK ({{message-fetch-ok}}) |
969+
|-------|-----------------------------------------------------|
970+
| 0x19 | FETCH_ERROR ({{message-fetch-error}}) |
971+
|-------|-----------------------------------------------------|
960972
| 0x40 | CLIENT_SETUP ({{message-setup}}) |
961973
|-------|-----------------------------------------------------|
962974
| 0x41 | SERVER_SETUP ({{message-setup}}) |
@@ -1191,7 +1203,11 @@ GOAWAY Message {
11911203

11921204
## SUBSCRIBE {#message-subscribe-req}
11931205

1194-
### Filter Types {#sub-filter}
1206+
A subscription causes the publisher to send newly published objects for a track.
1207+
A subscriber MUST NOT make multiple active subscriptions for a track within a
1208+
single session and publishers SHOULD treat this as a protocol violation.
1209+
1210+
**Filter Types**
11951211

11961212
The subscriber specifies a filter on the subscription to allow
11971213
the publisher to identify which objects need to be delivered.
@@ -1216,10 +1232,6 @@ object than StartGroup and StartObject.
12161232

12171233
A filter type other than the above MUST be treated as error.
12181234

1219-
1220-
### SUBSCRIBE Format
1221-
A subscriber issues a SUBSCRIBE to a publisher to request a track.
1222-
12231235
The format of SUBSCRIBE is as follows:
12241236

12251237
~~~
@@ -1272,7 +1284,6 @@ used. Values larger than 0x2 are a protocol error.
12721284

12731285
* Filter Type: Identifies the type of filter, which also indicates whether
12741286
the StartGroup/StartObject and EndGroup/EndObject fields will be present.
1275-
See ({{sub-filter}}).
12761287

12771288
* StartGroup: The start Group ID. Only present for "AbsoluteStart" and
12781289
"AbsoluteRange" filter types.
@@ -1291,9 +1302,9 @@ On successful subscription, the publisher MUST reply with a SUBSCRIBE_OK,
12911302
allowing the subscriber to determine the start group/object when not explicitly
12921303
specified and the publisher SHOULD start delivering objects.
12931304

1294-
If a publisher cannot satisfy the requested start or end for the subscription it
1295-
MAY send a SUBSCRIBE_ERROR with code 'Invalid Range'. A publisher MUST NOT send
1296-
objects from outside the requested start and end.
1305+
If a publisher cannot satisfy the requested start or end or if the end has
1306+
already been published it SHOULD send a SUBSCRIBE_ERROR with code 'Invalid Range'.
1307+
A publisher MUST NOT send objects from outside the requested start and end.
12971308

12981309
## SUBSCRIBE_UPDATE {#message-subscribe-update-req}
12991310

@@ -1371,6 +1382,114 @@ UNSUBSCRIBE Message {
13711382

13721383
* Subscribe ID: Subscription Identifier as defined in {{message-subscribe-req}}.
13731384

1385+
1386+
## FETCH {#message-fetch}
1387+
1388+
A subscriber issues a FETCH to a publisher to request a range of already published
1389+
objects within a track. The publisher responding to a FETCH is responsible for retrieving
1390+
all available Objects. If there are gaps between Objects, the publisher omits them from the
1391+
fetch response. All omitted objects have status Object Not Available.
1392+
1393+
A publisher responds to a FETCH request with either a FETCH_OK or a FETCH_ERROR
1394+
message. If it responds with FETCH_OK, the publisher creates a new unidirectional
1395+
stream that is used to send the Objects. A relay MAY start sending objects immediately
1396+
in response to a FETCH, even if sending the FETCH_OK takes longer because it requires
1397+
going upstream to populate the latest object.
1398+
1399+
The Object Forwarding Preference does not apply to fetches.
1400+
1401+
Fetch specifies an inclusive range of Objects starting at StartObject
1402+
in StartGroup and ending at EndObject in EndGroup. EndGroup and EndObject MUST
1403+
specify the same or a later object than StartGroup and StartObject.
1404+
1405+
The format of FETCH is as follows:
1406+
1407+
~~~
1408+
FETCH Message {
1409+
Type (i) = 0x16,
1410+
Length (i),
1411+
Subscribe ID (i),
1412+
Track Namespace (tuple),
1413+
Track Name Length (i),
1414+
Track Name (..),
1415+
Subscriber Priority (8),
1416+
Group Order (8),
1417+
StartGroup (i),
1418+
StartObject (i),
1419+
EndGroup (i),
1420+
EndObject (i),
1421+
Number of Parameters (i),
1422+
Parameters (..) ...
1423+
}
1424+
~~~
1425+
{: #moq-transport-fetch-format title="MOQT FETCH Message"}
1426+
1427+
* Subscribe ID: The Subscribe ID identifies a given fetch request. Subscribe ID
1428+
is a variable length integer that MUST be unique and monotonically increasing
1429+
within a session.
1430+
1431+
* Track Namespace: Identifies the namespace of the track as defined in
1432+
({{track-name}}).
1433+
1434+
* Track Name: Identifies the track name as defined in ({{track-name}}).
1435+
1436+
* Subscriber Priority: Specifies the priority of a fetch request relative to
1437+
other subscriptions or fetches in the same session. Lower numbers get higher
1438+
priority. See {{priorities}}.
1439+
1440+
* Group Order: Allows the subscriber to request Objects be delivered in
1441+
Ascending (0x1) or Descending (0x2) order by group. See {{priorities}}.
1442+
A value of 0x0 indicates the original publisher's Group Order SHOULD be
1443+
used. Values larger than 0x2 are a protocol error.
1444+
1445+
* StartGroup: The start Group ID.
1446+
1447+
* StartObject: The start Object ID.
1448+
1449+
* EndGroup: The end Group ID.
1450+
1451+
* EndObject: The end Object ID, plus 1. A value of 0 means the entire group is
1452+
requested.
1453+
1454+
* Parameters: The parameters are defined in {{version-specific-params}}.
1455+
1456+
1457+
Objects that are not yet published will not be retrieved by a FETCH.
1458+
The latest available Object is indicated in the FETCH_OK, and is the last
1459+
Object a fetch will return if the EndGroup and EndObject have not yet been
1460+
published.
1461+
1462+
A publisher MUST send fetched groups in the determined group order, either
1463+
ascending or descending. Within each group, objects are sent in Object ID order;
1464+
subgroup ID is not used for ordering.
1465+
1466+
If StartGroup/StartObject is greater than the latest published Object group,
1467+
the publisher MUST return FETCH_ERROR with error code 'No Objects'.
1468+
1469+
A publisher MUST send fetched groups in group order, either ascending or
1470+
descending. Within each group, objects are sent in Object ID order;
1471+
subgroup ID is not used for ordering.
1472+
1473+
## FETCH_CANCEL {#message-fetch-cancel}
1474+
1475+
A subscriber issues a `FETCH_CANCEL` message to a publisher indicating it is no
1476+
longer interested in receiving Objects for the fetch specified by 'Subscribe ID'.
1477+
The publisher SHOULD close the unidirectional stream as soon as possible.
1478+
1479+
The format of `FETCH_CANCEL` is as follows:
1480+
1481+
~~~
1482+
FETCH_CANCEL Message {
1483+
Type (i) = 0x17,
1484+
Length (i),
1485+
Subscribe ID (i)
1486+
}
1487+
~~~
1488+
{: #moq-transport-fetch-cancel title="MOQT FETCH_CANCEL Message"}
1489+
1490+
* Subscribe ID: Subscription Identifier as defined in {{message-fetch}}.
1491+
1492+
13741493
## ANNOUNCE_OK {#message-announce-ok}
13751494

13761495
The subscriber sends an ANNOUNCE_OK control message to acknowledge the
@@ -1604,6 +1723,71 @@ SUBSCRIBE_ERROR
16041723
({{session-termination}}).
16051724

16061725

1726+
## FETCH_OK {#message-fetch-ok}
1727+
1728+
A publisher sends a FETCH_OK control message in response to successful fetches.
1729+
A publisher MAY send Objects in response to a FETCH before the FETCH_OK message is sent,
1730+
but the FETCH_OK MUST NOT be sent until the latest group and object are known.
1731+
1732+
~~~
1733+
FETCH_OK
1734+
{
1735+
Type (i) = 0x18,
1736+
Length (i),
1737+
Subscribe ID (i),
1738+
Group Order (8),
1739+
End Of Track (8),
1740+
Largest Group ID (i),
1741+
Largest Object ID (i),
1742+
Number of Parameters (i),
1743+
Subscribe Parameters (..) ...
1744+
}
1745+
~~~
1746+
{: #moq-transport-fetch-ok format title="MOQT FETCH_OK Message"}
1747+
1748+
* Subscribe ID: Fetch Identifier as defined in {{message-fetch}}.
1749+
1750+
* Group Order: Indicates the fetch will be delivered in
1751+
Ascending (0x1) or Descending (0x2) order by group. See {{priorities}}.
1752+
Values of 0x0 and those larger than 0x2 are a protocol error.
1753+
1754+
* End Of Track: 1 if all objects have been published on this track, so
1755+
the Largest Group ID and Object Id indicate the last Object in the track,
1756+
0 if not.
1757+
1758+
* Largest Group ID: The largest Group ID available for this track. This field
1759+
is only present if ContentExists has a value of 1.
1760+
1761+
* Largest Object ID: The largest Object ID available within the largest Group ID
1762+
for this track. This field is only present if ContentExists has a value of 1.
1763+
1764+
* Subscribe Parameters: The parameters are defined in {{version-specific-params}}.
1765+
1766+
## FETCH_ERROR {#message-fetch-error}
1767+
1768+
A publisher sends a FETCH_ERROR control message in response to a
1769+
failed FETCH.
1770+
1771+
~~~
1772+
FETCH_ERROR
1773+
{
1774+
Type (i) = 0x19,
1775+
Length (i),
1776+
Subscribe ID (i),
1777+
Error Code (i),
1778+
Reason Phrase Length (i),
1779+
Reason Phrase (..),
1780+
}
1781+
~~~
1782+
{: #moq-transport-fetch-error format title="MOQT FETCH_ERROR Message"}
1783+
1784+
* Subscribe ID: Subscription Identifier as defined in {{message-subscribe-req}}.
1785+
1786+
* Error Code: Identifies an integer error code for fetch failure.
1787+
1788+
* Reason Phrase: Provides the reason for fetch error.
1789+
1790+
16071791
## SUBSCRIBE_DONE {#message-subscribe-done}
16081792

16091793
A publisher sends a `SUBSCRIBE_DONE` message to indicate it is done publishing
@@ -1812,6 +1996,7 @@ failure.
18121996
* Reason Phrase: Provides the reason for the namespace subscription error.
18131997

18141998

1999+
18152000
# Data Streams {#data-streams}
18162001

18172002
A publisher sends Objects matching a subscription on Data Streams.
@@ -1826,6 +2011,8 @@ variable-length integer indicating the type of the stream in question.
18262011
|-------|-------------------------------------------------------|
18272012
| 0x4 | STREAM_HEADER_SUBGROUP ({{stream-header-subgroup}}) |
18282013
|-------|-------------------------------------------------------|
2014+
| 0x5 | FETCH_HEADER ({{fetch-header}}) |
2015+
|-------|-------------------------------------------------------|
18292016

18302017
An endpoint that receives an unknown stream type MUST close the session.
18312018

@@ -1920,7 +2107,6 @@ will be dropped.
19202107

19212108
~~~
19222109
OBJECT_DATAGRAM Message {
1923-
Subscribe ID (i),
19242110
Track Alias (i),
19252111
Group ID (i),
19262112
Object ID (i),
@@ -1954,7 +2140,6 @@ ID` and the subgroup indicated by 'Group ID' and `Subgroup ID`.
19542140

19552141
~~~
19562142
STREAM_HEADER_SUBGROUP Message {
1957-
Subscribe ID (i),
19582143
Track Alias (i),
19592144
Group ID (i),
19602145
Subgroup ID (i),
@@ -1986,13 +2171,44 @@ The Object Status field is only sent if the Object Payload Length is zero.
19862171
A publisher MUST NOT send an Object on a stream if its Object ID is less than a
19872172
previously sent Object ID within a given group in that stream.
19882173

2174+
2175+
### Fetch Header {#fetch-header}
2176+
2177+
When a stream begins with `FETCH_HEADER`, all objects on the stream belong to the
2178+
track requested in the Fetch message identified by `Subscribe ID`.
2179+
2180+
~~~
2181+
FETCH_HEADER Message {
2182+
Subscribe ID (i),
2183+
}
2184+
~~~
2185+
{: #fetch-header-format title="MOQT FETCH_HEADER Message"}
2186+
2187+
2188+
Each object sent on a fetch stream after the FETCH_HEADER has the following format:
2189+
2190+
~~~
2191+
{
2192+
Group ID (i),
2193+
Subgroup ID (i),
2194+
Object ID (i),
2195+
Publisher Priority (8),
2196+
Object Payload Length (i),
2197+
[Object Status (i)],
2198+
Object Payload (..),
2199+
}
2200+
~~~
2201+
{: #object-fetch-format title="MOQT Fetch Object Fields"}
2202+
2203+
The Object Status field is only sent if the Object Payload Length is zero.
2204+
2205+
19892206
## Examples
19902207

19912208
Sending a track on one stream:
19922209

19932210
~~~
19942211
STREAM_HEADER_TRACK {
1995-
Subscribe ID = 1
19962212
Track Alias = 1
19972213
Publisher Priority = 0
19982214
}
@@ -2016,7 +2232,6 @@ Sending a subgroup on one stream:
20162232
Stream = 2
20172233

20182234
STREAM_HEADER_SUBGROUP {
2019-
Subscribe ID = 2
20202235
Track Alias = 2
20212236
Group ID = 0
20222237
Subgroup ID = 0

0 commit comments

Comments
 (0)