@@ -70,7 +70,7 @@ mod val_batch {
70
70
use timely:: progress:: { Antichain , frontier:: AntichainRef } ;
71
71
72
72
use crate :: trace:: { Batch , BatchReader , Builder , Cursor , Description , Merger } ;
73
- use crate :: trace:: implementations:: { BatchContainer , OffsetList } ;
73
+ use crate :: trace:: implementations:: BatchContainer ;
74
74
use crate :: trace:: cursor:: MyTrait ;
75
75
76
76
use super :: { Layout , Update } ;
@@ -83,7 +83,7 @@ mod val_batch {
83
83
/// Offsets used to provide indexes from keys to values.
84
84
///
85
85
/// The length of this list is one longer than `keys`, so that we can avoid bounds logic.
86
- pub keys_offs : OffsetList ,
86
+ pub keys_offs : L :: OffsetContainer ,
87
87
/// Concatenated ordered lists of values, bracketed by offsets in `keys_offs`.
88
88
pub vals : L :: ValContainer ,
89
89
/// Offsets used to provide indexes from values to updates.
@@ -94,20 +94,20 @@ mod val_batch {
94
94
/// single common update values (e.g. in a snapshot, the minimal time and a diff of one).
95
95
///
96
96
/// The length of this list is one longer than `vals`, so that we can avoid bounds logic.
97
- pub vals_offs : OffsetList ,
97
+ pub vals_offs : L :: OffsetContainer ,
98
98
/// Concatenated ordered lists of updates, bracketed by offsets in `vals_offs`.
99
99
pub updates : L :: UpdContainer ,
100
100
}
101
101
102
102
impl < L : Layout > OrdValStorage < L > {
103
103
/// Lower and upper bounds in `self.vals` corresponding to the key at `index`.
104
104
fn values_for_key ( & self , index : usize ) -> ( usize , usize ) {
105
- ( self . keys_offs . index ( index) , self . keys_offs . index ( index+1 ) )
105
+ ( self . keys_offs . index ( index) . into_owned ( ) , self . keys_offs . index ( index+1 ) . into_owned ( ) )
106
106
}
107
107
/// Lower and upper bounds in `self.updates` corresponding to the value at `index`.
108
108
fn updates_for_value ( & self , index : usize ) -> ( usize , usize ) {
109
- let mut lower = self . vals_offs . index ( index) ;
110
- let upper = self . vals_offs . index ( index+1 ) ;
109
+ let mut lower = self . vals_offs . index ( index) . into_owned ( ) ;
110
+ let upper = self . vals_offs . index ( index+1 ) . into_owned ( ) ;
111
111
// We use equal lower and upper to encode "singleton update; just before here".
112
112
// It should only apply when there is a prior element, so `lower` should be greater than zero.
113
113
if lower == upper {
@@ -206,14 +206,17 @@ mod val_batch {
206
206
207
207
let mut storage = OrdValStorage {
208
208
keys : L :: KeyContainer :: merge_capacity ( & batch1. keys , & batch2. keys ) ,
209
- keys_offs : OffsetList :: with_capacity ( batch1. keys_offs . len ( ) + batch2. keys_offs . len ( ) ) ,
209
+ keys_offs : L :: OffsetContainer :: with_capacity ( batch1. keys_offs . len ( ) + batch2. keys_offs . len ( ) ) ,
210
210
vals : L :: ValContainer :: merge_capacity ( & batch1. vals , & batch2. vals ) ,
211
- vals_offs : OffsetList :: with_capacity ( batch1. vals_offs . len ( ) + batch2. vals_offs . len ( ) ) ,
211
+ vals_offs : L :: OffsetContainer :: with_capacity ( batch1. vals_offs . len ( ) + batch2. vals_offs . len ( ) ) ,
212
212
updates : L :: UpdContainer :: merge_capacity ( & batch1. updates , & batch2. updates ) ,
213
213
} ;
214
214
215
- storage. keys_offs . push ( 0 ) ;
216
- storage. vals_offs . push ( 0 ) ;
215
+ // Mark explicit types because type inference fails to resolve it.
216
+ let keys_offs: & mut L :: OffsetContainer = & mut storage. keys_offs ;
217
+ keys_offs. push ( 0 ) ;
218
+ let vals_offs: & mut L :: OffsetContainer = & mut storage. vals_offs ;
219
+ vals_offs. push ( 0 ) ;
217
220
218
221
OrdValMerger {
219
222
key_cursor1 : 0 ,
@@ -546,9 +549,9 @@ mod val_batch {
546
549
Self {
547
550
result : OrdValStorage {
548
551
keys : L :: KeyContainer :: with_capacity ( keys) ,
549
- keys_offs : OffsetList :: with_capacity ( keys + 1 ) ,
552
+ keys_offs : L :: OffsetContainer :: with_capacity ( keys + 1 ) ,
550
553
vals : L :: ValContainer :: with_capacity ( vals) ,
551
- vals_offs : OffsetList :: with_capacity ( vals + 1 ) ,
554
+ vals_offs : L :: OffsetContainer :: with_capacity ( vals + 1 ) ,
552
555
updates : L :: UpdContainer :: with_capacity ( upds) ,
553
556
} ,
554
557
singleton : None ,
@@ -636,7 +639,7 @@ mod key_batch {
636
639
use timely:: progress:: { Antichain , frontier:: AntichainRef } ;
637
640
638
641
use crate :: trace:: { Batch , BatchReader , Builder , Cursor , Description , Merger } ;
639
- use crate :: trace:: implementations:: { BatchContainer , OffsetList } ;
642
+ use crate :: trace:: implementations:: BatchContainer ;
640
643
use crate :: trace:: cursor:: MyTrait ;
641
644
642
645
use super :: { Layout , Update } ;
@@ -654,16 +657,16 @@ mod key_batch {
654
657
/// single common update values (e.g. in a snapshot, the minimal time and a diff of one).
655
658
///
656
659
/// The length of this list is one longer than `keys`, so that we can avoid bounds logic.
657
- pub keys_offs : OffsetList ,
660
+ pub keys_offs : L :: OffsetContainer ,
658
661
/// Concatenated ordered lists of updates, bracketed by offsets in `vals_offs`.
659
662
pub updates : L :: UpdContainer ,
660
663
}
661
664
662
665
impl < L : Layout > OrdKeyStorage < L > {
663
666
/// Lower and upper bounds in `self.vals` corresponding to the key at `index`.
664
667
fn updates_for_key ( & self , index : usize ) -> ( usize , usize ) {
665
- let mut lower = self . keys_offs . index ( index) ;
666
- let upper = self . keys_offs . index ( index+1 ) ;
668
+ let mut lower = self . keys_offs . index ( index) . into_owned ( ) ;
669
+ let upper = self . keys_offs . index ( index+1 ) . into_owned ( ) ;
667
670
// We use equal lower and upper to encode "singleton update; just before here".
668
671
// It should only apply when there is a prior element, so `lower` should be greater than zero.
669
672
if lower == upper {
@@ -763,11 +766,12 @@ mod key_batch {
763
766
764
767
let mut storage = OrdKeyStorage {
765
768
keys : L :: KeyContainer :: merge_capacity ( & batch1. keys , & batch2. keys ) ,
766
- keys_offs : OffsetList :: with_capacity ( batch1. keys_offs . len ( ) + batch2. keys_offs . len ( ) ) ,
769
+ keys_offs : L :: OffsetContainer :: with_capacity ( batch1. keys_offs . len ( ) + batch2. keys_offs . len ( ) ) ,
767
770
updates : L :: UpdContainer :: merge_capacity ( & batch1. updates , & batch2. updates ) ,
768
771
} ;
769
772
770
- storage. keys_offs . push ( 0 ) ;
773
+ let keys_offs: & mut L :: OffsetContainer = & mut storage. keys_offs ;
774
+ keys_offs. push ( 0 ) ;
771
775
772
776
OrdKeyMerger {
773
777
key_cursor1 : 0 ,
@@ -1011,7 +1015,7 @@ mod key_batch {
1011
1015
Self {
1012
1016
result : OrdKeyStorage {
1013
1017
keys : L :: KeyContainer :: with_capacity ( keys) ,
1014
- keys_offs : OffsetList :: with_capacity ( keys + 1 ) ,
1018
+ keys_offs : L :: OffsetContainer :: with_capacity ( keys + 1 ) ,
1015
1019
updates : L :: UpdContainer :: with_capacity ( upds) ,
1016
1020
} ,
1017
1021
singleton : None ,
0 commit comments