Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.

Commit d768701

Browse files
author
Clément Le Provost
committed
[offline] Expose hasOfflineData() method at index level
1 parent f069a94 commit d768701

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

algoliasearch/src/offline/java/com/algolia/search/saas/MirroredIndex.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,17 @@ public void run()
615615
// Bootstrapping
616616
// ----------------------------------------------------------------------
617617

618+
/**
619+
* Test if this index has offline data on disk.
620+
*
621+
* **Warning:** This method is synchronous! It will block until completion.
622+
*
623+
* @return `true` if data exists on disk for this index, `false` otherwise.
624+
*/
625+
public boolean hasOfflineData() {
626+
return localIndex.exists();
627+
}
628+
618629
/**
619630
* Bootstrap the local mirror with local data stored on the filesystem.
620631
*

algoliasearch/src/offline/java/com/algolia/search/saas/OfflineIndex.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,17 @@ private void flushObjectsToDisk(boolean force) throws AlgoliaException {
818818
return new WriteTransaction();
819819
}
820820

821+
/**
822+
* Test if this index has offline data on disk.
823+
*
824+
* **Warning:** This method is synchronous! It will block until completion.
825+
*
826+
* @return `true` if data exists on disk for this index, `false` otherwise.
827+
*/
828+
public boolean hasOfflineData() {
829+
return localIndex.exists();
830+
}
831+
821832
// ----------------------------------------------------------------------
822833
// Helpers
823834
// ----------------------------------------------------------------------

0 commit comments

Comments
 (0)