@@ -37,10 +37,9 @@ import {
37
37
localStoreConfigureFieldIndexes ,
38
38
localStoreDeleteAllFieldIndexes ,
39
39
localStoreExecuteQuery ,
40
- localStoreSetIndexAutoCreationEnabled ,
40
+ localStoreGetOrSetFieldIndexManagementApi ,
41
41
localStoreWriteLocally ,
42
- newLocalStore ,
43
- TestingHooks as LocalStoreTestingHooks
42
+ newLocalStore
44
43
} from '../../../src/local/local_store_impl' ;
45
44
import { Persistence } from '../../../src/local/persistence' ;
46
45
import { DocumentMap } from '../../../src/model/collections' ;
@@ -72,6 +71,7 @@ import {
72
71
import { CountingQueryEngine } from './counting_query_engine' ;
73
72
import * as persistenceHelpers from './persistence_test_helpers' ;
74
73
import { JSON_SERIALIZER } from './persistence_test_helpers' ;
74
+ import { FieldIndexManagementApiImpl } from '../../../src/index/field_index_management' ;
75
75
76
76
class AsyncLocalStoreTester {
77
77
private bundleConverter : BundleConverterImpl ;
@@ -143,13 +143,28 @@ class AsyncLocalStoreTester {
143
143
} ) : void {
144
144
this . prepareNextStep ( ) ;
145
145
146
- if ( config . isEnabled !== undefined ) {
147
- localStoreSetIndexAutoCreationEnabled ( this . localStore , config . isEnabled ) ;
148
- }
149
- LocalStoreTestingHooks . setIndexAutoCreationSettings (
146
+ const fieldIndexManagementApi = localStoreGetOrSetFieldIndexManagementApi (
150
147
this . localStore ,
151
- config
148
+ ( ) => new FieldIndexManagementApiImpl ( )
152
149
) ;
150
+ if ( ! ( fieldIndexManagementApi instanceof FieldIndexManagementApiImpl ) ) {
151
+ throw new Error (
152
+ `fieldIndexManagementApi should be an instance of ` +
153
+ `FieldIndexManagementApiImpl: $fieldIndexManagementApi`
154
+ ) ;
155
+ }
156
+
157
+ if ( config . isEnabled !== undefined ) {
158
+ fieldIndexManagementApi . indexAutoCreationEnabled = config . isEnabled ;
159
+ }
160
+ if ( config . indexAutoCreationMinCollectionSize !== undefined ) {
161
+ fieldIndexManagementApi . indexAutoCreationMinCollectionSize =
162
+ config . indexAutoCreationMinCollectionSize ;
163
+ }
164
+ if ( config . relativeIndexReadCostPerDocument !== undefined ) {
165
+ fieldIndexManagementApi . relativeIndexReadCostPerDocument =
166
+ config . relativeIndexReadCostPerDocument ;
167
+ }
153
168
}
154
169
155
170
deleteAllFieldIndexes ( ) : Promise < void > {
0 commit comments