File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -560,6 +560,40 @@ fn marker_for_offset(offset: &str, is_emulator: bool) -> String {
560
560
if is_emulator {
561
561
return offset. to_string ( ) ;
562
562
} else {
563
+ // Here we reconstruct an Azure marker (continuation token) from a key to be able to seek
564
+ // into an arbitrary position in the key space.
565
+ // The current format (July 2024) for the marker is as follows:
566
+ //
567
+ // +-> unpadded length of next field
568
+ // |
569
+ // | +-> unpadded length of base64 encoded field
570
+ // | |
571
+ // | | +-> base64 encoded field with padding characters (=) repaced with -
572
+ // | | |
573
+ // 2!72!MDAwMDA4IWZpbGUudHh0ITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaIQ--
574
+ // | | ^
575
+ // terminators |
576
+ // |
577
+ // +------------+
578
+ // Decoding the |base64 field| gives:
579
+ // +------------+
580
+ //
581
+ // +-> length of key field padded to 6 digits
582
+ // |
583
+ // | +-> key to start listing at
584
+ // | |
585
+ // | | +-> length of timestamp field padded to 6 digits
586
+ // | | |
587
+ // | | | +-> constant max timestamp field
588
+ // | | | |
589
+ // 000008!file.txt!000028!9999-12-31T23:59:59.9999999Z!
590
+ // | | | |
591
+ // +----> field terminators <-------------------+
592
+ //
593
+ // When recostructing we add a space character (ASCII 0x20) to the end of the key to change the
594
+ // `start_at` behavior into a `start_after` behavior as the space character is the first valid character
595
+ // in the lexicographical order.
596
+
563
597
let encoded_part = BASE64_STANDARD . encode (
564
598
& format ! ( "{:06}!{} !000028!9999-12-31T23:59:59.9999999Z!" , offset. len( ) + 1 , offset)
565
599
) . replace ( "=" , "-" ) ;
You can’t perform that action at this time.
0 commit comments