File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -438,6 +438,7 @@ pub struct EntityWithType {
438438 pub entity_op : EntitySubgraphOperation ,
439439 pub entity_type : EntityType ,
440440 pub entity : Entity ,
441+ pub vid : i64 ,
441442}
442443
443444async fn get_entities_for_range (
Original file line number Diff line number Diff line change @@ -550,10 +550,12 @@ impl Layout {
550550 let block = ede. block_number ;
551551 let entity_type = e. entity_type ( & self . input_schema ) ;
552552 let entity = e. deserialize_with_layout :: < Entity > ( self , None ) ?;
553+ let vid = ede. vid ;
553554 let ewt = EntityWithType {
554555 entity_op,
555556 entity_type,
556557 entity,
558+ vid,
557559 } ;
558560 Ok ( ( ewt, block) )
559561 } ;
@@ -609,6 +611,12 @@ impl Layout {
609611 }
610612 } ;
611613 }
614+
615+ // sort the elements in each blocks bucket by vid
616+ for ( _, vec) in & mut entities {
617+ vec. sort_by ( |a, b| a. vid . cmp ( & b. vid ) ) ;
618+ }
619+
612620 Ok ( entities)
613621 }
614622
Original file line number Diff line number Diff line change @@ -568,6 +568,8 @@ pub struct EntityDataExt {
568568 pub block_number : i32 ,
569569 #[ diesel( sql_type = Text ) ]
570570 pub id : String ,
571+ #[ diesel( sql_type = BigInt ) ]
572+ pub vid : i64 ,
571573}
572574
573575impl Ord for EntityDataExt {
@@ -2068,7 +2070,7 @@ impl<'a> QueryFragment<Pg> for FindRangeQuery<'a> {
20682070 } else {
20692071 self . mut_range . compare_column ( & mut out)
20702072 }
2071- out. push_sql ( "as block_number, id\n " ) ;
2073+ out. push_sql ( "as block_number, id, vid \n " ) ;
20722074 out. push_sql ( " from " ) ;
20732075 out. push_sql ( table. qualified_name . as_str ( ) ) ;
20742076 out. push_sql ( " e\n where" ) ;
You can’t perform that action at this time.
0 commit comments