public class IndexCopier extends java.lang.Object implements CopyOnReadStatsMBean, java.io.Closeable
| Modifier and Type | Class and Description |
|---|---|
static interface |
IndexCopier.COWDirectoryTracker |
| Modifier and Type | Field and Description |
|---|---|
static java.util.Set<java.lang.String> |
REMOTE_ONLY |
TYPE| Constructor and Description |
|---|
IndexCopier(java.util.concurrent.Executor executor,
java.io.File indexRootDir) |
IndexCopier(java.util.concurrent.Executor executor,
java.io.File indexRootDir,
boolean prefetchEnabled) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
copyDone() |
boolean |
deleteFile(org.apache.lucene.store.Directory dir,
java.lang.String fileName,
boolean copiedFromRemote) |
void |
doneCopy(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexFile file,
long start) |
void |
foundInvalidFile() |
int |
getCopyInProgressCount() |
java.lang.String[] |
getCopyInProgressDetails() |
java.lang.String |
getCopyInProgressSize() |
int |
getDeletedFilesCount() |
int |
getDownloadCount() |
java.lang.String |
getDownloadSize() |
long |
getDownloadTime() |
java.lang.String |
getGarbageCollectedSize() |
java.lang.String[] |
getGarbageDetails() |
java.lang.String |
getGarbageSize() |
java.io.File |
getIndexDir(org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition definition,
java.lang.String indexPath,
java.lang.String dirName) |
javax.management.openmbean.TabularData |
getIndexPathMapping() |
int |
getInvalidFileCount() |
long |
getLocalIndexDirSize() |
java.lang.String |
getLocalIndexSize() |
int |
getMaxCopyInProgressCount() |
int |
getMaxScheduledForCopyCount() |
static long |
getNewestLocalFSTimestampFor(java.util.Set<java.lang.String> names,
org.apache.lucene.store.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() |
java.lang.String |
getSkippedFromUploadSize() |
int |
getUploadCount() |
java.lang.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(java.lang.String name,
org.apache.lucene.store.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. |
org.apache.lucene.store.Directory |
wrapForRead(java.lang.String indexPath,
LuceneIndexDefinition definition,
org.apache.lucene.store.Directory remote,
java.lang.String dirName) |
org.apache.lucene.store.Directory |
wrapForWrite(LuceneIndexDefinition definition,
org.apache.lucene.store.Directory remote,
boolean reindexMode,
java.lang.String dirName,
IndexCopier.COWDirectoryTracker cowDirectoryTracker) |
public IndexCopier(java.util.concurrent.Executor executor,
java.io.File indexRootDir)
throws java.io.IOException
java.io.IOExceptionpublic IndexCopier(java.util.concurrent.Executor executor,
java.io.File indexRootDir,
boolean prefetchEnabled)
throws java.io.IOException
java.io.IOExceptionpublic org.apache.lucene.store.Directory wrapForRead(java.lang.String indexPath,
LuceneIndexDefinition definition,
org.apache.lucene.store.Directory remote,
java.lang.String dirName)
throws java.io.IOException
java.io.IOExceptionpublic org.apache.lucene.store.Directory wrapForWrite(LuceneIndexDefinition definition, org.apache.lucene.store.Directory remote, boolean reindexMode, java.lang.String dirName, IndexCopier.COWDirectoryTracker cowDirectoryTracker) throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic boolean isClosed()
public java.io.File getIndexDir(org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition definition,
java.lang.String indexPath,
java.lang.String dirName)
throws java.io.IOException
java.io.IOExceptionpublic boolean deleteFile(org.apache.lucene.store.Directory dir,
java.lang.String fileName,
boolean copiedFromRemote)
public static long getNewestLocalFSTimestampFor(java.util.Set<java.lang.String> names,
org.apache.lucene.store.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(java.lang.String name,
org.apache.lucene.store.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 javax.management.openmbean.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 java.lang.String getDownloadSize()
getDownloadSize in interface CopyOnReadStatsMBeanpublic long getDownloadTime()
getDownloadTime in interface CopyOnReadStatsMBeanpublic int getDownloadCount()
getDownloadCount in interface CopyOnReadStatsMBeanpublic int getUploadCount()
getUploadCount in interface CopyOnReadStatsMBeanpublic java.lang.String getUploadSize()
getUploadSize in interface CopyOnReadStatsMBeanpublic long getUploadTime()
getUploadTime in interface CopyOnReadStatsMBeanpublic java.lang.String getLocalIndexSize()
getLocalIndexSize in interface CopyOnReadStatsMBeanpublic long getLocalIndexDirSize()
getLocalIndexDirSize in interface CopyOnReadStatsMBeanpublic java.lang.String[] getGarbageDetails()
getGarbageDetails in interface CopyOnReadStatsMBeanpublic java.lang.String getGarbageSize()
getGarbageSize in interface CopyOnReadStatsMBeanpublic int getScheduledForCopyCount()
getScheduledForCopyCount in interface CopyOnReadStatsMBeanpublic int getCopyInProgressCount()
getCopyInProgressCount in interface CopyOnReadStatsMBeanpublic java.lang.String getCopyInProgressSize()
getCopyInProgressSize in interface CopyOnReadStatsMBeanpublic int getMaxCopyInProgressCount()
getMaxCopyInProgressCount in interface CopyOnReadStatsMBeanpublic int getMaxScheduledForCopyCount()
getMaxScheduledForCopyCount in interface CopyOnReadStatsMBeanpublic java.lang.String getSkippedFromUploadSize()
getSkippedFromUploadSize in interface CopyOnReadStatsMBeanpublic java.lang.String[] getCopyInProgressDetails()
getCopyInProgressDetails in interface CopyOnReadStatsMBeanpublic int getDeletedFilesCount()
getDeletedFilesCount in interface CopyOnReadStatsMBeanpublic java.lang.String getGarbageCollectedSize()
getGarbageCollectedSize in interface CopyOnReadStatsMBeanCopyright © 2010 - 2023 Adobe. All Rights Reserved