public class IndexCopier extends Object implements CopyOnReadStatsMBean, Closeable
| Modifier and Type | Class and Description |
|---|---|
static interface |
IndexCopier.COWDirectoryTracker |
| Modifier and Type | Field and Description |
|---|---|
static Set<String> |
REMOTE_ONLY |
TYPE| Constructor and Description |
|---|
IndexCopier(Executor executor,
File indexRootDir) |
IndexCopier(Executor executor,
File indexRootDir,
boolean prefetchEnabled) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
copyDone() |
boolean |
deleteFile(Directory dir,
String fileName,
boolean copiedFromRemote) |
void |
doneCopy(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file,
long start) |
void |
foundInvalidFile() |
int |
getCopyInProgressCount() |
String[] |
getCopyInProgressDetails() |
String |
getCopyInProgressSize() |
int |
getDeletedFilesCount() |
int |
getDownloadCount() |
String |
getDownloadSize() |
long |
getDownloadTime() |
String |
getGarbageCollectedSize() |
String[] |
getGarbageDetails() |
String |
getGarbageSize() |
File |
getIndexDir(org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition definition,
String indexPath,
String dirName) |
TabularData |
getIndexPathMapping() |
int |
getInvalidFileCount() |
long |
getLocalIndexDirSize() |
String |
getLocalIndexSize() |
int |
getMaxCopyInProgressCount() |
int |
getMaxScheduledForCopyCount() |
static long |
getNewestLocalFSTimestampFor(Set<String> names,
Directory localDir)
This method would return the latest modification timestamp from the set of file
names
on the file system. |
int |
getReaderLocalReadCount() |
int |
getReaderRemoteReadCount() |
int |
getScheduledForCopyCount() |
String |
getSkippedFromUploadSize() |
int |
getUploadCount() |
String |
getUploadSize() |
long |
getUploadTime() |
int |
getWriterLocalReadCount() |
int |
getWriterRemoteReadCount() |
boolean |
isClosed() |
boolean |
isCopyInProgress(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file) |
static boolean |
isFileModifiedBefore(String name,
Directory localDir,
long millis) |
boolean |
isPrefetchEnabled() |
void |
readFromLocal(boolean reader) |
void |
readFromRemote(boolean reader) |
void |
scheduledForCopy() |
void |
skippedUpload(long skippedFilesSize) |
long |
startCopy(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file) |
void |
waitForCopyCompletion(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file,
long timeoutMillis)
Waits for maximum of
timeoutMillis while checking if file isn't being copied already. |
Directory |
wrapForRead(String indexPath,
LuceneIndexDefinition definition,
Directory remote,
String dirName) |
Directory |
wrapForWrite(LuceneIndexDefinition definition,
Directory remote,
boolean reindexMode,
String dirName,
IndexCopier.COWDirectoryTracker cowDirectoryTracker) |
public IndexCopier(Executor executor, File indexRootDir) throws IOException
IOExceptionpublic IndexCopier(Executor executor, File indexRootDir, boolean prefetchEnabled) throws IOException
IOExceptionpublic Directory wrapForRead(String indexPath, LuceneIndexDefinition definition, Directory remote, String dirName) throws IOException
IOExceptionpublic Directory wrapForWrite(LuceneIndexDefinition definition, Directory remote, boolean reindexMode, String dirName, IndexCopier.COWDirectoryTracker cowDirectoryTracker) throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean isClosed()
public File getIndexDir(org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition definition, String indexPath, String dirName) throws IOException
IOExceptionpublic static long getNewestLocalFSTimestampFor(Set<String> names, Directory localDir)
names
on the file system.
The parameter localDir is expected to be an instance of FSDirectory (or wrapped one in
FilterDirectory. If this assumption doesn't hold, the method would return -1.
Each of file names are expected to be existing in localDir. If this fails the method shall return -1.
In case of any error while computing modified timestamps on the file system, the method shall return -1.names - file names to evaluate on local FSlocalDir - Directory implementation to be used to get the filespublic static boolean isFileModifiedBefore(String name, Directory localDir, long millis)
name - file name to evaluate on local FSlocalDir - Directory implementation to be used to get the filemillis - timestamp to compare file's modified timestamp againsttrue if file referred to be name is modified before millis; false otherwisepublic long startCopy(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file)
public boolean isCopyInProgress(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file)
public void waitForCopyCompletion(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file,
long timeoutMillis)
timeoutMillis while checking if file isn't being copied already.
The method can return before timeoutMillis if it got interrupted. So, if required then the
caller should check using isCopyInProgress and wait again.file - timeoutMillis - public void doneCopy(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file,
long start)
public void skippedUpload(long skippedFilesSize)
public void scheduledForCopy()
public void copyDone()
public void readFromRemote(boolean reader)
public void readFromLocal(boolean reader)
public void foundInvalidFile()
public TabularData getIndexPathMapping()
getIndexPathMapping in interface CopyOnReadStatsMBeanpublic boolean isPrefetchEnabled()
isPrefetchEnabled in interface CopyOnReadStatsMBeanpublic int getReaderLocalReadCount()
getReaderLocalReadCount in interface CopyOnReadStatsMBeanpublic int getReaderRemoteReadCount()
getReaderRemoteReadCount in interface CopyOnReadStatsMBeanpublic int getWriterLocalReadCount()
getWriterLocalReadCount in interface CopyOnReadStatsMBeanpublic int getWriterRemoteReadCount()
getWriterRemoteReadCount in interface CopyOnReadStatsMBeanpublic int getInvalidFileCount()
public String getDownloadSize()
getDownloadSize in interface CopyOnReadStatsMBeanpublic long getDownloadTime()
getDownloadTime in interface CopyOnReadStatsMBeanpublic int getDownloadCount()
getDownloadCount in interface CopyOnReadStatsMBeanpublic int getUploadCount()
getUploadCount in interface CopyOnReadStatsMBeanpublic String getUploadSize()
getUploadSize in interface CopyOnReadStatsMBeanpublic long getUploadTime()
getUploadTime in interface CopyOnReadStatsMBeanpublic String getLocalIndexSize()
getLocalIndexSize in interface CopyOnReadStatsMBeanpublic long getLocalIndexDirSize()
getLocalIndexDirSize in interface CopyOnReadStatsMBeanpublic String[] getGarbageDetails()
getGarbageDetails in interface CopyOnReadStatsMBeanpublic String getGarbageSize()
getGarbageSize in interface CopyOnReadStatsMBeanpublic int getScheduledForCopyCount()
getScheduledForCopyCount in interface CopyOnReadStatsMBeanpublic int getCopyInProgressCount()
getCopyInProgressCount in interface CopyOnReadStatsMBeanpublic String getCopyInProgressSize()
getCopyInProgressSize in interface CopyOnReadStatsMBeanpublic int getMaxCopyInProgressCount()
getMaxCopyInProgressCount in interface CopyOnReadStatsMBeanpublic int getMaxScheduledForCopyCount()
getMaxScheduledForCopyCount in interface CopyOnReadStatsMBeanpublic String getSkippedFromUploadSize()
getSkippedFromUploadSize in interface CopyOnReadStatsMBeanpublic String[] getCopyInProgressDetails()
getCopyInProgressDetails in interface CopyOnReadStatsMBeanpublic int getDeletedFilesCount()
getDeletedFilesCount in interface CopyOnReadStatsMBeanpublic String getGarbageCollectedSize()
getGarbageCollectedSize in interface CopyOnReadStatsMBeanCopyright © 2010 - 2020 Adobe. All Rights Reserved