You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -179,6 +183,30 @@ The message encoding and schema must match that of the Channel record correspond
179
183
| 8 | publish_time | Timestamp | Time at which the message was published. If not available, must be set to the log time. |
180
184
| N | data | Bytes | Message data, to be decoded according to the schema of the channel. |
181
185
186
+
### Secondary Index Key (op=0x10)
187
+
188
+
A Secondary Index Key record defines a secondary timestamp index that will be used in this file.
189
+
Secondary Indexes can be used to quickly look up messages by timestamps other than `log_time`.
190
+
The `name` field identifies the timestamp key that messages will be indexed by. The [registry](./registry.md#secondary-index-keys) lists well-known secondary index key names.
191
+
192
+
A Secondary Index Key record must appear before any [Secondary Message Index](#secondary-message-index-op0x11) records
193
+
in the data section with this `secondary_index_id`.
194
+
195
+
Secondary Index Key records in the Data section must also appear in the Summary section, before
196
+
any [Secondary Chunk Index](#secondary-chunk-index-op0x12) records with this `secondary_index_id`.
| 4 + N | records |`Array<Tuple<Timestamp, uint64>>`| Array of timestamp and offset for each record. Offset is relative to the start of the uncompressed chunk data. |
248
+
210
249
### Chunk Index (op=0x08)
211
250
212
251
A Chunk Index record contains the location of a Chunk record and its associated Message Index records.
@@ -229,6 +268,18 @@ A Schema and Channel record MUST exist in the summary section for all channels r
229
268
230
269
> Why? The typical use case for file readers using an index is fast random access to a specific message timestamp. Channel is a prerequisite for decoding Message record data. Without an easy-to-access copy of the Channel records, readers would need to search for Channel records from the start of the file, degrading random access read performance.
231
270
271
+
### Secondary Chunk Index (op=0x12)
272
+
273
+
A secondary Chunk Index record contains additional secondary index information on top of the corresponding Chunk Index record.
| 8 | chunk_start_offset | uint64 | Offset to the chunk record from the start of the file. |
279
+
| 8 | earliest_key | Timestamp | Earliest key in the chunk. Zero if the chunk contains no messages with this key. |
280
+
| 8 | latest_key | Timestamp | Latest key in the chunk. Zero if the chunk contains no messages with this key. |
281
+
| 4 + N | message_index_offsets |`Map<uint16, uint64>`| Mapping from channel ID to the offset of the message index record for that channel after the chunk, from the start of the file. An empty map indicates no message indexing is available. |
282
+
232
283
### Attachment (op=0x09)
233
284
234
285
Attachment records contain auxiliary artifacts such as text, core dumps, calibration data, or other arbitrary data.
@@ -522,6 +573,52 @@ A writer may choose to put messages in Chunks to compress record data. This MCAP
522
573
[Footer]
523
574
```
524
575
576
+
### Multiple Messages with a Secondary Index
577
+
578
+
```
579
+
[Header]
580
+
[Secondary Index Key 1]
581
+
[Chunk A]
582
+
[Schema A]
583
+
[Channel 1 (A)]
584
+
[Channel 2 (B)]
585
+
[Message on 1]
586
+
[Message on 1]
587
+
[Message on 2]
588
+
[Message Index 1]
589
+
[Message Index 2]
590
+
[Secondary Message Index 1 (Channel 1)]
591
+
[Secondary Message Index 1 (Channel 2)]
592
+
[Attachment 1]
593
+
[Chunk B]
594
+
[Schema B]
595
+
[Channel 3 (B)]
596
+
[Message on 3]
597
+
[Message on 1]
598
+
[Message Index 3]
599
+
[Message Index 1]
600
+
[Secondary Message Index 1 (Channel 3)]
601
+
[Secondary Message Index 1 (Channel 1)]
602
+
[Data End]
603
+
[Schema A]
604
+
[Schema B]
605
+
[Channel 1]
606
+
[Channel 2]
607
+
[Channel 3]
608
+
[Secondary Index Key 1]
609
+
[Chunk Index A]
610
+
[Chunk Index B]
611
+
[Secondary Chunk Index 1 (Chunk A)]
612
+
[Secondary Chunk Index 1 (Chunk B)]
613
+
[Attachment Index 1]
614
+
[Statistics]
615
+
[Summary Offset 0x01]
616
+
[Summary Offset 0x05]
617
+
[Summary Offset 0x07]
618
+
[Summary Offset 0x08]
619
+
[Footer]
620
+
```
621
+
525
622
## Further Reading
526
623
527
624
-[Feature explanations][feature_explanations]: includes usage details that may be useful to implementers of readers or writers.
0 commit comments