public class IndexCopier extends Object implements CopyOnReadStatsMBean, Closeable
| 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) |
public IndexCopier(Executor executor, File indexRootDir) throws IOException
IOExceptionpublic IndexCopier(Executor executor, File indexRootDir, boolean prefetchEnabled) throws IOException
IOExceptionpublic org.apache.lucene.store.Directory wrapForRead(String indexPath, LuceneIndexDefinition definition, org.apache.lucene.store.Directory remote, String dirName) throws IOException
IOExceptionpublic org.apache.lucene.store.Directory wrapForWrite(LuceneIndexDefinition definition, org.apache.lucene.store.Directory remote, boolean reindexMode, String dirName) throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean isClosed()
protected org.apache.lucene.store.Directory createLocalDirForIndexWriter(LuceneIndexDefinition definition, String dirName) throws IOException
IOExceptionprotected org.apache.lucene.store.Directory createLocalDirForIndexReader(String indexPath, LuceneIndexDefinition definition, String dirName) throws IOException
IOExceptionpublic File getIndexDir(org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition definition, String indexPath, String dirName) throws IOException
IOExceptionpublic boolean deleteFile(org.apache.lucene.store.Directory dir,
String fileName,
boolean copiedFromRemote)
public static long getNewestLocalFSTimestampFor(Set<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(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(LocalIndexFile file)
public boolean isCopyInProgress(LocalIndexFile file)
public void doneCopy(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 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 © 2012–2018 The Apache Software Foundation. All rights reserved.