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.IOException
public IndexCopier(java.util.concurrent.Executor executor, java.io.File indexRootDir, boolean prefetchEnabled) throws java.io.IOException
java.io.IOException
public 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.IOException
public 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.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public 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.IOException
public 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 CopyOnReadStatsMBean
public boolean isPrefetchEnabled()
isPrefetchEnabled
in interface CopyOnReadStatsMBean
public int getReaderLocalReadCount()
getReaderLocalReadCount
in interface CopyOnReadStatsMBean
public int getReaderRemoteReadCount()
getReaderRemoteReadCount
in interface CopyOnReadStatsMBean
public int getWriterLocalReadCount()
getWriterLocalReadCount
in interface CopyOnReadStatsMBean
public int getWriterRemoteReadCount()
getWriterRemoteReadCount
in interface CopyOnReadStatsMBean
public int getInvalidFileCount()
public java.lang.String getDownloadSize()
getDownloadSize
in interface CopyOnReadStatsMBean
public long getDownloadTime()
getDownloadTime
in interface CopyOnReadStatsMBean
public int getDownloadCount()
getDownloadCount
in interface CopyOnReadStatsMBean
public int getUploadCount()
getUploadCount
in interface CopyOnReadStatsMBean
public java.lang.String getUploadSize()
getUploadSize
in interface CopyOnReadStatsMBean
public long getUploadTime()
getUploadTime
in interface CopyOnReadStatsMBean
public java.lang.String getLocalIndexSize()
getLocalIndexSize
in interface CopyOnReadStatsMBean
public long getLocalIndexDirSize()
getLocalIndexDirSize
in interface CopyOnReadStatsMBean
public java.lang.String[] getGarbageDetails()
getGarbageDetails
in interface CopyOnReadStatsMBean
public java.lang.String getGarbageSize()
getGarbageSize
in interface CopyOnReadStatsMBean
public int getScheduledForCopyCount()
getScheduledForCopyCount
in interface CopyOnReadStatsMBean
public int getCopyInProgressCount()
getCopyInProgressCount
in interface CopyOnReadStatsMBean
public java.lang.String getCopyInProgressSize()
getCopyInProgressSize
in interface CopyOnReadStatsMBean
public int getMaxCopyInProgressCount()
getMaxCopyInProgressCount
in interface CopyOnReadStatsMBean
public int getMaxScheduledForCopyCount()
getMaxScheduledForCopyCount
in interface CopyOnReadStatsMBean
public java.lang.String getSkippedFromUploadSize()
getSkippedFromUploadSize
in interface CopyOnReadStatsMBean
public java.lang.String[] getCopyInProgressDetails()
getCopyInProgressDetails
in interface CopyOnReadStatsMBean
public int getDeletedFilesCount()
getDeletedFilesCount
in interface CopyOnReadStatsMBean
public java.lang.String getGarbageCollectedSize()
getGarbageCollectedSize
in interface CopyOnReadStatsMBean
Copyright © 2010 - 2020 Adobe. All Rights Reserved