Skip to content

Commit 1903232

Browse files
authored
Merge pull request #42 from donmendelson/v2-0-issue26
Adding new variable length field in a repeating group #26
2 parents 6212b72 + 20f0046 commit 1903232

File tree

10 files changed

+122
-186
lines changed

10 files changed

+122
-186
lines changed

v1-0-STANDARD/doc/01Introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ References
149149

150150
### Related FIX Standards
151151

152-
*Simple Open Framing Header*, FIX Protocol, Limited. Release Candidate 1
152+
*Simple Open Framing Header*, FIX Protocol, Limited. Version 1.0 Draft Standard
153153
specification has been published at
154154
<http://www.fixtradingcommunity.org/>
155155

v1-0-STANDARD/doc/03MessageStructure.md

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ Message Structure
44
Message Framing
55
------------------------------------------------------------------------------------------------------------------------------------------------------------
66

7-
SBE messages need framing when used with protocols that do not preserve
8-
message boundaries, such as when they are transmitted on a streaming
9-
session protocol or are persisted in storage. Be aware that framing
10-
features may or may not be encoded in SBE.
7+
SBE messages have no defined message delimiter. Version 2.0 of SBE makes it possible to walk the elements of a message to determine its limit, even when the message has been extended. Nevertheless, since internal framing depends on a correct starting point and not encountering malformed messages, it may be desirable to use an external framing protocol when used with transports that do not preserve message boundaries, such as when they are transmitted on a streaming
8+
session protocol or when persisting messages in storage.
119

1210
### Simple Open Framing Header
1311

@@ -73,6 +71,10 @@ The fields of the SBE message header are:
7371
- **Schema version** - the version of the message schema in which the
7472
message is defined
7573

74+
- **Group count** - the number of repeating groups in the root level of the message
75+
76+
- **Variable-length field count** - the number of variable-length fields in the root level of the message
77+
7678
Block length is specified in a message schema, but it is also serialized
7779
on the wire. By default, block length is set to the sum of the sizes of
7880
body fields in the message. However, it may be increased to force
@@ -95,17 +97,21 @@ Recommended message header encoding
9597
<type name="templateId" primitiveType="uint16"/>
9698
<type name="schemaId" primitiveType="uint16"/>
9799
<type name="version" primitiveType="uint16"/>
100+
<type name="numGroups" primitiveType="uint16" />
101+
<type name="numVarDataFields" primitiveType="uint16" />
98102
</composite>
99103
```
100104

101-
The recommended header encoding is 8 octets.
105+
The recommended header encoding is 12 octets.
102106

103107
| Element | Description | Primitive type | Length (octets) | Offset |
104108
|-------------|-------------------|----------------|----------------:|-------:|
105109
| blockLength | Root block length | uint16 | 2 | 0 |
106110
| templateId | Template ID | uint16 | 2 | 2 |
107111
| schemaId | Schema ID | uint16 | 2 | 4 |
108112
| version | Schema Version | uint16 | 2 | 6 |
113+
| numGroups |Number of repeating groups | uint16 | 2 | 8 |
114+
| numVarDataFields | Number of variable-length fields | uint16 | 2 | 10 |
109115

110116
Optionally, implementations may support any other unsigned integer types
111117
for blockLength.
@@ -141,6 +147,15 @@ attributes.
141147
The version number of the message schema that was used to encode a
142148
message. See section 4.3.1 below for schema attributes.
143149

150+
### Number of repeating groups
151+
152+
A count of repeating groups at the root level of the message. The count does not include nested repeating groups.
153+
154+
### Number of variable-length fields
155+
156+
A count of the variable-length fields at the root level of the message. The count does not include variable-length fields within repeating groups.
157+
158+
144159
Message Body
145160
----------------------------------------------------------------------------------------------------------
146161

@@ -425,12 +440,31 @@ Recommended encoding of repeating group dimensions
425440
<composite name="groupSizeEncoding">
426441
<type name="blockLength" primitiveType="uint16"/>
427442
<type name="numInGroup" primitiveType="uint16" semanticType="NumInGroup"/>
443+
<type name="numGroups" primitiveType="uint16" />
444+
<type name="numVarDataFields" primitiveType="uint16" />
428445
</composite>
429446
```
430447

431-
Wire format of NumInGroup with block length 55 octets by 3 entries
448+
#### Block length
449+
450+
The total space reserved for the fixed-length fields of this repeating group, not counting
451+
any repeating groups or variable-length fields.
452+
453+
#### Number of entries
432454

433-
`37000300`
455+
The number of entries in this repeating group, called NumInGroup in FIX.
456+
457+
##### Number of repeating groups
458+
459+
A count nested repeating groups in this repeating group.
460+
461+
#### Number of variable-length fields
462+
463+
A count of the variable-length fields in this repeating group.
464+
465+
Wire format of NumInGroup with block length 55 octets by 3 entries, containing one nested group and two variable-length fields.
466+
467+
`3700030001000200`
434468

435469
#### Restricting repeating group entries
436470

@@ -439,10 +473,7 @@ The occurrences of a repeating group may be restricted to a specific range by mo
439473
Example of a restricted group encoding
440474

441475
```xml
442-
<composite name="restrictedGroupSizeEncoding">
443-
<type name="blockLength" primitiveType="uint16"/>
444-
<type name="numInGroup" primitiveType="uint16" semanticType="NumInGroup" minValue="1" maxValue="10" />
445-
</composite>
476+
<type name="numInGroup" primitiveType="uint16" semanticType="NumInGroup" minValue="1" maxValue="10" />
446477
```
447478

448479
Sequence of message body elements

v1-0-STANDARD/doc/04MessageSchema.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33

44
XML schema for SBE message schemas
55
---------
6-
See [SimpleBinary1-0.xsd](../resources/SimpleBinary1-0.xsd) for the normative XML Schema Definition (XSD) for SBE.
6+
See [sbe.xsd](../resources/sbe.xsd) for the normative XML Schema Definition (XSD) for SBE.
77

88

99
XML namespace
1010
-----------------------------------------------------------------------------------------------------------
1111

12-
The Simple Binary Encoding XML schema is identified by this URL:
12+
The Simple Binary Encoding XML schema is identified by this URL [*tentative*]:
1313

1414
```xml
15-
xmlns:sbe=http://fixprotocol.io/sbe/rc4
15+
xmlns:sbe=http://fixprotocol.io/2017/sbe
1616
```
1717

1818
Conventionally, the URI of the XML schema is aliased by the prefix

v1-0-STANDARD/doc/05SchemaExtensionMechanism.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ Compatibility is only ensured under these conditions:
2222

2323
- Existing fields cannot change data type or move within a message.
2424

25-
- A repeating group may be added, but only after existing groups and
26-
if there are no subsequent variable data elements at the end of the
27-
message.
25+
- A repeating group may be added after existing groups at the root level or nested within another repeating group.
2826

29-
- A variable data element may be added, but only after existing groups
30-
and data.
27+
- A variable-length data field may be added after existing variable-length data at the root level or within a repeating group.
3128

3229
- Message header encoding cannot change.
3330

@@ -92,14 +89,6 @@ migration to replacement message layouts.
9289
Wire format features for extension
9390
----------------------------------
9491

95-
### Message size
96-
97-
It is assumed that a either message boundaries are delimited by a
98-
transport or session protocol header conveys the size of the whole
99-
message. See section 3.1 above. This enables a consumer to properly
100-
frame messages even when the message has been lengthened in a later
101-
version of the schema.
102-
10392
### Block size
10493

10594
The length of the root level of the message is sent on the wire in the
@@ -113,6 +102,10 @@ does not break parsing of earlier fields.
113102
Likewise, block size of a repeating group is conveyed in the NumInGroup
114103
encoding.
115104

105+
### Number of repeating groups and variable data
106+
107+
Message headers and repeating group dimensions carry a count of the number of repeating groups and a count of variable-length data fields on the wire. This supports a walk by a decoder of all the elements of a message, even when the decoder was built with an older version of a schema. As for added fixed-length fields, new repeating groups cannot be interpreted by the decoder, but it still can process the ones it knows, and it can correctly reach the end of a message.
108+
116109
Comaptibility strategy
117110
-----------------------
118111
*This suggested strategy is non-normative.*
Lines changed: 8 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,16 @@
11
Release Notes
22
=============
3-
Release Candidate 4
4-
-------------------
5-
6-
These issues were resolved and accepted for Release Candidate 4. See issues and pull requests
7-
in GitHub for details and changes.
83

9-
| Issue | Description | Section |
10-
|------:|----------------------------------------------------------------|---------|
11-
| 2 | Schema extension is vague in terms of what compatibility means | 5
12-
| 3 | Extensibility of the Template ID | 5
13-
| 6 | Limiting maximum occurences of repeating group | 3
14-
| 8 | blockLength for repeating groups of variable length | 3
15-
| 11 | Offsets within composite types | 4
16-
| 12 | Composites reusing other types | 4
4+
These are the changes made since SBE version 1.0.
175

18-
Release Candidate 3
6+
SBE version 2.0 Release Candidate 1
197
-------------------
8+
These issues were resolved and accepted for version 2.0 Release Candidate 1. See [issues](https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/issues) and [pull requests](https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/pulls) in GitHub for details and changes.
209

21-
This is a summary of document changes to Release Candidate 3 from RC2.
22-
Changes in this release were intended only as clarifications or to add
23-
capabilities. Message schemas that conformed to the RC2 specification
24-
should still conform to the RC3 wire format.
25-
26-
**Section 1**
27-
28-
References section expanded.
29-
30-
**Section 2**
31-
32-
- Statement added that non-FIX data types should not carry a
33-
semanticType attribute in a message schema.
34-
35-
- String encoding section split into two sections for strings (text
36-
fields) and data (non-character data) to clarify the distinction.
37-
Both text and non-text can be either fixed-length `<field>` or
38-
variable-length `<data>`.
39-
40-
- Timestamp encoding enhanced to allow time unit to either be
41-
specified as a constant in a message schema or to be serialized on
42-
the wire.
43-
44-
**Section 3**
45-
46-
Message structure is enhanced to allow variable-length `<data>` elements
47-
within a repeating group entry.
48-
49-
**Section 4**
50-
51-
Message schema XSD updated to support `<data>` in repeating groups and
52-
for various other refinements
53-
54-
**Section 5**
55-
56-
- Statements added to say whole repeating groups or variable data may
57-
be added to a message without breaking compatibility so long as the
58-
added elements are at the end of a message.
59-
60-
- Added deprecated schema attribute to mark obsolete elements.
61-
62-
**Section 6**
63-
64-
No change
65-
66-
**Section 7**
67-
68-
Examples updated to use Simple Open Framing Header.
10+
| Issue | Description |
11+
|------:|----------------------------------------------------------------|
12+
| 26 | Adding new variable length field in a repeating group |
6913

70-
**Section 8**
14+
### Compatibility
7115

72-
Release notes added.
16+
Version 2.0 is not back-compatible SBE version 1.0, either in wire format or XML schema.

v1-0-STANDARD/resources/sbe.xsd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<xs:schema xmlns:sbe="http://fixprotocol.io/2016/sbe" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://fixprotocol.io/2016/sbe" elementFormDefault="unqualified" version="1.0 Draft Standard">
2+
<xs:schema xmlns:sbe="http://fixprotocol.io/2017/sbe" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://fixprotocol.io/2017/sbe" elementFormDefault="unqualified" version="2.0-RC1">
33
<xs:annotation>
44
<xs:documentation>
55
Message schema for FIX Simple Binary Encoding
6-
Version: 1.0 Draft Standard
7-
© Copyright 2014-2016 FIX Protocol Limited
6+
Version: 2.0 Release Candidate 1
7+
© Copyright 2014-2017 FIX Protocol Limited
88
License: Creative Commons Attribution-NoDerivatives 4.0 International Public License
99
</xs:documentation>
1010
</xs:annotation>

v2-0-RC1/doc/03MessageStructure.md

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ Message Structure
44
Message Framing
55
------------------------------------------------------------------------------------------------------------------------------------------------------------
66

7-
SBE messages need framing when used with protocols that do not preserve
8-
message boundaries, such as when they are transmitted on a streaming
9-
session protocol or are persisted in storage. Be aware that framing
10-
features may or may not be encoded in SBE.
7+
SBE messages have no defined message delimiter. Version 2.0 of SBE makes it possible to walk the elements of a message to determine its limit, even when the message has been extended. Nevertheless, since internal framing depends on a correct starting point and not encountering malformed messages, it may be desirable to use an external framing protocol when used with transports that do not preserve message boundaries, such as when they are transmitted on a streaming
8+
session protocol or when persisting messages in storage.
119

1210
### Simple Open Framing Header
1311

@@ -73,6 +71,10 @@ The fields of the SBE message header are:
7371
- **Schema version** - the version of the message schema in which the
7472
message is defined
7573

74+
- **Group count** - the number of repeating groups in the root level of the message
75+
76+
- **Variable-length field count** - the number of variable-length fields in the root level of the message
77+
7678
Block length is specified in a message schema, but it is also serialized
7779
on the wire. By default, block length is set to the sum of the sizes of
7880
body fields in the message. However, it may be increased to force
@@ -95,17 +97,21 @@ Recommended message header encoding
9597
<type name="templateId" primitiveType="uint16"/>
9698
<type name="schemaId" primitiveType="uint16"/>
9799
<type name="version" primitiveType="uint16"/>
100+
<type name="numGroups" primitiveType="uint16" />
101+
<type name="numVarDataFields" primitiveType="uint16" />
98102
</composite>
99103
```
100104

101-
The recommended header encoding is 8 octets.
105+
The recommended header encoding is 12 octets.
102106

103107
| Element | Description | Primitive type | Length (octets) | Offset |
104108
|-------------|-------------------|----------------|----------------:|-------:|
105109
| blockLength | Root block length | uint16 | 2 | 0 |
106110
| templateId | Template ID | uint16 | 2 | 2 |
107111
| schemaId | Schema ID | uint16 | 2 | 4 |
108112
| version | Schema Version | uint16 | 2 | 6 |
113+
| numGroups |Number of repeating groups | uint16 | 2 | 8 |
114+
| numVarDataFields | Number of variable-length fields | uint16 | 2 | 10 |
109115

110116
Optionally, implementations may support any other unsigned integer types
111117
for blockLength.
@@ -141,6 +147,15 @@ attributes.
141147
The version number of the message schema that was used to encode a
142148
message. See section 4.3.1 below for schema attributes.
143149

150+
### Number of repeating groups
151+
152+
A count of repeating groups at the root level of the message. The count does not include nested repeating groups.
153+
154+
### Number of variable-length fields
155+
156+
A count of the variable-length fields at the root level of the message. The count does not include variable-length fields within repeating groups.
157+
158+
144159
Message Body
145160
----------------------------------------------------------------------------------------------------------
146161

@@ -425,12 +440,31 @@ Recommended encoding of repeating group dimensions
425440
<composite name="groupSizeEncoding">
426441
<type name="blockLength" primitiveType="uint16"/>
427442
<type name="numInGroup" primitiveType="uint16" semanticType="NumInGroup"/>
443+
<type name="numGroups" primitiveType="uint16" />
444+
<type name="numVarDataFields" primitiveType="uint16" />
428445
</composite>
429446
```
430447

431-
Wire format of NumInGroup with block length 55 octets by 3 entries
448+
#### Block length
449+
450+
The total space reserved for the fixed-length fields of this repeating group, not counting
451+
any repeating groups or variable-length fields.
452+
453+
#### Number of entries
432454

433-
`37000300`
455+
The number of entries in this repeating group, called NumInGroup in FIX.
456+
457+
##### Number of repeating groups
458+
459+
A count nested repeating groups in this repeating group.
460+
461+
#### Number of variable-length fields
462+
463+
A count of the variable-length fields in this repeating group.
464+
465+
Wire format of NumInGroup with block length 55 octets by 3 entries, containing one nested group and two variable-length fields.
466+
467+
`3700030001000200`
434468

435469
#### Restricting repeating group entries
436470

@@ -439,10 +473,7 @@ The occurrences of a repeating group may be restricted to a specific range by mo
439473
Example of a restricted group encoding
440474

441475
```xml
442-
<composite name="restrictedGroupSizeEncoding">
443-
<type name="blockLength" primitiveType="uint16"/>
444-
<type name="numInGroup" primitiveType="uint16" semanticType="NumInGroup" minValue="1" maxValue="10" />
445-
</composite>
476+
<type name="numInGroup" primitiveType="uint16" semanticType="NumInGroup" minValue="1" maxValue="10" />
446477
```
447478

448479
Sequence of message body elements

0 commit comments

Comments
 (0)