@@ -169,7 +169,7 @@ public class MirroredIndex extends Index
169
169
private SyncStats stats ;
170
170
171
171
private Set <SyncListener > syncListeners = new HashSet <>();
172
- private Set <BootstrapListener > bootstrapListeners = new HashSet <>();
172
+ private Set <BuildListener > buildListeners = new HashSet <>();
173
173
174
174
// ----------------------------------------------------------------------
175
175
// Constants
@@ -728,19 +728,25 @@ private void _buildOfflineFromRawResources(@NonNull final Resources resources, @
728
728
// Build the index.
729
729
_buildOffline (settingsFile , objectFiles );
730
730
} catch (IOException e ) {
731
- Log .e (MirroredIndex .class .getSimpleName (), "Failed to write bootstrap resources to disk" , e );
731
+ Log .e (MirroredIndex .class .getSimpleName (), "Failed to write build resources to disk" , e );
732
732
} finally {
733
733
// Delete temporary files.
734
734
FileUtils .deleteRecursive (tmpDir );
735
735
}
736
736
}
737
737
738
+ /**
739
+ * Build the local mirror (synchronously).
740
+ *
741
+ * @param settingsFile The file containing index settings.
742
+ * @param objectFiles The files containing objects.
743
+ */
738
744
private void _buildOffline (@ NonNull File settingsFile , @ NonNull File ... objectFiles ) {
739
745
// Notify listeners.
740
746
getClient ().mainHandler .post (new Runnable () {
741
747
@ Override
742
748
public void run () {
743
- fireBootstrapDidStart ();
749
+ fireBuildDidStart ();
744
750
}
745
751
});
746
752
@@ -759,7 +765,7 @@ public void run() {
759
765
if (status != 200 ) {
760
766
error = new AlgoliaException (String .format ("Failed to build local mirror \" %s\" " , MirroredIndex .this .getIndexName ()), status );
761
767
}
762
- fireBootstrapDidFinish (error );
768
+ fireBuildDidFinish (error );
763
769
}
764
770
});
765
771
}
@@ -1314,33 +1320,33 @@ private void fireSyncDidFinish()
1314
1320
}
1315
1321
}
1316
1322
1317
- // BootstrapListener
1323
+ // BuildListener
1318
1324
1319
1325
/**
1320
1326
* Add a listener for bootstrapping events.
1321
1327
* @param listener The listener to add.
1322
1328
*/
1323
- public void addBootstrapListener (@ NonNull BootstrapListener listener ) {
1324
- bootstrapListeners .add (listener );
1329
+ public void addBootstrapListener (@ NonNull BuildListener listener ) {
1330
+ buildListeners .add (listener );
1325
1331
}
1326
1332
1327
1333
/**
1328
1334
* Remove a listener for bootstrapping events.
1329
1335
* @param listener The listener to remove.
1330
1336
*/
1331
- public void removeBootstrapListener (@ NonNull BootstrapListener listener ) {
1332
- bootstrapListeners .remove (listener );
1337
+ public void removeBootstrapListener (@ NonNull BuildListener listener ) {
1338
+ buildListeners .remove (listener );
1333
1339
}
1334
1340
1335
- private void fireBootstrapDidStart () {
1336
- for (BootstrapListener listener : bootstrapListeners ) {
1337
- listener .bootstrapDidStart (this );
1341
+ private void fireBuildDidStart () {
1342
+ for (BuildListener listener : buildListeners ) {
1343
+ listener .buildDidStart (this );
1338
1344
}
1339
1345
}
1340
1346
1341
- private void fireBootstrapDidFinish (@ Nullable Throwable error ) {
1342
- for (BootstrapListener listener : bootstrapListeners ) {
1343
- listener .bootstrapDidFinish (this , error );
1347
+ private void fireBuildDidFinish (@ Nullable Throwable error ) {
1348
+ for (BuildListener listener : buildListeners ) {
1349
+ listener .buildDidFinish (this , error );
1344
1350
}
1345
1351
}
1346
1352
}
0 commit comments