File tree Expand file tree Collapse file tree 4 files changed +6
-10
lines changed
graph/src/components/store Expand file tree Collapse file tree 4 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -235,7 +235,8 @@ pub trait ReadStore: Send + Sync + 'static {
235235 keys : BTreeSet < EntityKey > ,
236236 ) -> Result < BTreeMap < EntityKey , Entity > , StoreError > ;
237237
238- /// Looks up entities using the given store key for a range of blocks.
238+ /// Returns all versions of entities of the given entity_type that were
239+ /// changed in the given block_range.
239240 fn get_range (
240241 & self ,
241242 entity_type : & EntityType ,
Original file line number Diff line number Diff line change @@ -140,11 +140,11 @@ pub enum EntityBlockRange {
140140}
141141
142142impl EntityBlockRange {
143- pub fn new ( immutable : bool , block_range : std:: ops:: Range < BlockNumber > ) -> Self {
143+ pub fn new ( table : & Table , block_range : std:: ops:: Range < BlockNumber > ) -> Self {
144144 let start: Bound < BlockNumber > = Bound :: Included ( block_range. start ) ;
145145 let end: Bound < BlockNumber > = Bound :: Excluded ( block_range. end ) ;
146146 let block_range: BlockRange = BlockRange ( start, end) ;
147- if immutable {
147+ if table . immutable {
148148 Self :: Immutable ( block_range)
149149 } else {
150150 Self :: Mutable ( block_range)
Original file line number Diff line number Diff line change @@ -530,12 +530,7 @@ impl Layout {
530530 for e in vec {
531531 let block = e. clone ( ) . deserialize_block_number :: < Entity > ( ) ?;
532532 let en = e. deserialize_with_layout :: < Entity > ( self , None ) ?;
533- match entities. get_mut ( & block) {
534- Some ( vec) => vec. push ( en) ,
535- None => {
536- let _ = entities. insert ( block, vec ! [ en] ) ;
537- }
538- } ;
533+ entities. entry ( block) . or_default ( ) . push ( en) ;
539534 }
540535 }
541536 Ok ( entities)
Original file line number Diff line number Diff line change @@ -2014,7 +2014,7 @@ pub struct FindRangeQuery<'a> {
20142014
20152015impl < ' a > FindRangeQuery < ' a > {
20162016 pub fn new ( table : & ' a Table , block_range : Range < BlockNumber > ) -> Self {
2017- let eb_range = EntityBlockRange :: new ( table. immutable , block_range) ;
2017+ let eb_range = EntityBlockRange :: new ( & table, block_range) ;
20182018 Self { table, eb_range }
20192019 }
20202020}
You can’t perform that action at this time.
0 commit comments