@@ -5,7 +5,7 @@ use std::{
55
66use async_trait:: async_trait;
77use common:: {
8- document:: GenericDocument ,
8+ document:: DeveloperDocument ,
99 index:: IndexKeyBytes ,
1010 interval:: Interval ,
1111 knobs:: {
@@ -29,21 +29,21 @@ use common::{
2929use super :: {
3030 query_scanned_too_many_documents_error,
3131 query_scanned_too_much_data,
32- IndexRangeResponse ,
32+ DeveloperIndexRangeResponse ,
3333 QueryStream ,
3434 QueryStreamNext ,
35- QueryType ,
3635 DEFAULT_QUERY_PREFETCH ,
3736 MAX_QUERY_FETCH ,
3837} ;
3938use crate :: {
4039 metrics,
4140 transaction:: IndexRangeRequest ,
4241 Transaction ,
42+ UserFacingModel ,
4343} ;
4444
4545/// A `QueryStream` that scans a range of an index.
46- pub struct IndexRange < T : QueryType > {
46+ pub struct IndexRange {
4747 stable_index_name : StableIndexName ,
4848 /// For usage and error messages. If the table mapping has changed, this
4949 /// might get out of sync with `stable_index_name`, which is the index
@@ -60,7 +60,7 @@ pub struct IndexRange<T: QueryType> {
6060 /// `cursor_interval` must always be a subset of `interval`.
6161 cursor_interval : CursorInterval ,
6262 intermediate_cursors : Option < Vec < CursorPosition > > ,
63- page : VecDeque < ( IndexKeyBytes , GenericDocument < T :: T > , WriteTimestamp ) > ,
63+ page : VecDeque < ( IndexKeyBytes , DeveloperDocument , WriteTimestamp ) > ,
6464 /// The interval which we have yet to fetch.
6565 /// This starts as an intersection of the IndexRange's `interval` and
6666 /// `cursor_interval`, and gets smaller as results are fetched into `page`.
@@ -81,7 +81,7 @@ pub struct IndexRange<T: QueryType> {
8181 version : Option < Version > ,
8282}
8383
84- impl < T : QueryType > IndexRange < T > {
84+ impl IndexRange {
8585 pub fn new (
8686 stable_index_name : StableIndexName ,
8787 printable_index_name : IndexName ,
@@ -146,7 +146,7 @@ impl<T: QueryType> IndexRange<T> {
146146 & mut self ,
147147 tx : & mut Transaction < RT > ,
148148 prefetch_hint : Option < usize > ,
149- ) -> anyhow:: Result < QueryStreamNext < T > > {
149+ ) -> anyhow:: Result < QueryStreamNext > {
150150 // If we have an end cursor, for correctness we need to process
151151 // the entire interval, so ignore `maximum_rows_read` and `maximum_bytes_read`.
152152 let enforce_limits = self . cursor_interval . end_inclusive . is_none ( ) ;
@@ -169,7 +169,7 @@ impl<T: QueryType> IndexRange<T> {
169169 }
170170 self . cursor_interval . curr_exclusive = Some ( CursorPosition :: After ( index_position) ) ;
171171 self . returned_results += 1 ;
172- T :: record_read_document ( tx, & v, self . printable_index_name . table ( ) ) ?;
172+ UserFacingModel :: new ( tx) . record_read_document ( & v, self . printable_index_name . table ( ) ) ?;
173173 // Database bandwidth for index reads
174174 tx. usage_tracker . track_database_egress_size (
175175 self . printable_index_name . table ( ) . to_string ( ) ,
@@ -216,7 +216,7 @@ impl<T: QueryType> IndexRange<T> {
216216
217217 fn process_fetch (
218218 & mut self ,
219- page : Vec < ( IndexKeyBytes , GenericDocument < T :: T > , WriteTimestamp ) > ,
219+ page : Vec < ( IndexKeyBytes , DeveloperDocument , WriteTimestamp ) > ,
220220 fetch_cursor : CursorPosition ,
221221 ) -> anyhow:: Result < ( ) > {
222222 let ( _, new_unfetched_interval) = self . unfetched_interval . split ( fetch_cursor, self . order ) ;
@@ -234,7 +234,7 @@ pub const fn soft_data_limit(hard_limit: usize) -> usize {
234234}
235235
236236#[ async_trait]
237- impl < T : QueryType > QueryStream < T > for IndexRange < T > {
237+ impl QueryStream for IndexRange {
238238 fn cursor_position ( & self ) -> & Option < CursorPosition > {
239239 & self . cursor_interval . curr_exclusive
240240 }
@@ -257,11 +257,11 @@ impl<T: QueryType> QueryStream<T> for IndexRange<T> {
257257 & mut self ,
258258 tx : & mut Transaction < RT > ,
259259 prefetch_hint : Option < usize > ,
260- ) -> anyhow:: Result < QueryStreamNext < T > > {
260+ ) -> anyhow:: Result < QueryStreamNext > {
261261 self . start_next ( tx, prefetch_hint)
262262 }
263263
264- fn feed ( & mut self , index_range_response : IndexRangeResponse < T :: T > ) -> anyhow:: Result < ( ) > {
264+ fn feed ( & mut self , index_range_response : DeveloperIndexRangeResponse ) -> anyhow:: Result < ( ) > {
265265 self . process_fetch ( index_range_response. page , index_range_response. cursor )
266266 }
267267
@@ -270,7 +270,7 @@ impl<T: QueryType> QueryStream<T> for IndexRange<T> {
270270 }
271271}
272272
273- impl < T : QueryType > Drop for IndexRange < T > {
273+ impl Drop for IndexRange {
274274 fn drop ( & mut self ) {
275275 metrics:: log_index_range (
276276 self . returned_results ,
0 commit comments