@@ -31,22 +31,39 @@ import { DocumentKeySet, DocumentMap } from '../../../src/model/collections';
31
31
*/
32
32
export class CountingQueryEngine implements QueryEngine {
33
33
/**
34
- * The number of mutations returned by the MutationQueue (since the last call
34
+ * The number of mutations returned by the MutationQueue's
35
+ * `getAllMutationBatchesAffectingQuery()` API (since the last call to
36
+ * `resetCounts()`)
37
+ */
38
+ mutationsReadByQuery = 0 ;
39
+
40
+ /**
41
+ * The number of mutations returned by the MutationQueue's
42
+ * `getAllMutationBatchesAffectingDocumentKey()` and
43
+ * `getAllMutationBatchesAffectingDocumentKeys()` APIs (since the last call
35
44
* to `resetCounts()`)
36
45
*/
37
- mutationsRead = 0 ;
46
+ mutationsReadByKey = 0 ;
47
+
48
+ /**
49
+ * The number of documents returned by the RemoteDocumentCache's
50
+ * `getDocumentsMatchingQuery()` API (since the last call to `resetCounts()`)
51
+ */
52
+ documentsReadByQuery = 0 ;
38
53
39
54
/**
40
- * The number of documents returned by the RemoteDocumentCache (since the
41
- * last call to `resetCounts()`)
55
+ * The number of documents returned by the RemoteDocumentCache's `getEntry()`
56
+ * and `getEntries()` APIs (since the last call to `resetCounts()`)
42
57
*/
43
- documentsRead = 0 ;
58
+ documentsReadByKey = 0 ;
44
59
45
60
constructor ( private readonly queryEngine : QueryEngine ) { }
46
61
47
62
resetCounts ( ) : void {
48
- this . mutationsRead = 0 ;
49
- this . documentsRead = 0 ;
63
+ this . mutationsReadByQuery = 0 ;
64
+ this . mutationsReadByKey = 0 ;
65
+ this . documentsReadByQuery = 0 ;
66
+ this . documentsReadByKey = 0 ;
50
67
}
51
68
52
69
getDocumentsMatchingQuery (
@@ -81,19 +98,19 @@ export class CountingQueryEngine implements QueryEngine {
81
98
return subject
82
99
. getDocumentsMatchingQuery ( transaction , query , sinceReadTime )
83
100
. next ( result => {
84
- this . documentsRead += result . size ;
101
+ this . documentsReadByQuery += result . size ;
85
102
return result ;
86
103
} ) ;
87
104
} ,
88
105
getEntries : ( transaction , documentKeys ) => {
89
106
return subject . getEntries ( transaction , documentKeys ) . next ( result => {
90
- this . documentsRead += result . size ;
107
+ this . documentsReadByKey += result . size ;
91
108
return result ;
92
109
} ) ;
93
110
} ,
94
111
getEntry : ( transaction , documentKey ) => {
95
112
return subject . getEntry ( transaction , documentKey ) . next ( result => {
96
- this . documentsRead += result ? 1 : 0 ;
113
+ this . documentsReadByKey += result ? 1 : 0 ;
97
114
return result ;
98
115
} ) ;
99
116
} ,
@@ -110,15 +127,15 @@ export class CountingQueryEngine implements QueryEngine {
110
127
checkEmpty : subject . checkEmpty ,
111
128
getAllMutationBatches : transaction => {
112
129
return subject . getAllMutationBatches ( transaction ) . next ( result => {
113
- this . mutationsRead += result . length ;
130
+ this . mutationsReadByKey += result . length ;
114
131
return result ;
115
132
} ) ;
116
133
} ,
117
134
getAllMutationBatchesAffectingDocumentKey : ( transaction , documentKey ) => {
118
135
return subject
119
136
. getAllMutationBatchesAffectingDocumentKey ( transaction , documentKey )
120
137
. next ( result => {
121
- this . mutationsRead += result . length ;
138
+ this . mutationsReadByKey += result . length ;
122
139
return result ;
123
140
} ) ;
124
141
} ,
@@ -129,15 +146,15 @@ export class CountingQueryEngine implements QueryEngine {
129
146
return subject
130
147
. getAllMutationBatchesAffectingDocumentKeys ( transaction , documentKeys )
131
148
. next ( result => {
132
- this . mutationsRead += result . length ;
149
+ this . mutationsReadByKey += result . length ;
133
150
return result ;
134
151
} ) ;
135
152
} ,
136
153
getAllMutationBatchesAffectingQuery : ( transaction , query ) => {
137
154
return subject
138
155
. getAllMutationBatchesAffectingQuery ( transaction , query )
139
156
. next ( result => {
140
- this . mutationsRead += result . length ;
157
+ this . mutationsReadByQuery += result . length ;
141
158
return result ;
142
159
} ) ;
143
160
} ,
0 commit comments