Class MultiFileWriter
- java.lang.Object
-
- org.elasticsearch.indices.recovery.MultiFileWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,Releasable
public class MultiFileWriter extends java.lang.Object implements Releasable
-
-
Constructor Summary
Constructors Constructor Description MultiFileWriter(Store store, RecoveryState.Index indexState, java.lang.String tempFilePrefix, org.apache.logging.log4j.Logger logger, java.lang.Runnable ensureOpen)
-
Method Summary
Modifier and Type Method Description voidclose()org.apache.lucene.store.IndexOutputgetOpenIndexOutput(java.lang.String key)org.apache.lucene.store.IndexOutputopenAndPutIndexOutput(java.lang.String fileName, StoreFileMetaData metaData, Store store)Creates anIndexOutputfor the given file name.org.apache.lucene.store.IndexOutputremoveOpenIndexOutputs(java.lang.String name)remove andIndexOutputfor a given file.voidrenameAllTempFiles()renames all temporary files to their true name, potentially overriding existing filesvoidwriteFileChunk(StoreFileMetaData fileMetaData, long position, BytesReference content, boolean lastChunk)
-
-
-
Constructor Detail
-
MultiFileWriter
public MultiFileWriter(Store store, RecoveryState.Index indexState, java.lang.String tempFilePrefix, org.apache.logging.log4j.Logger logger, java.lang.Runnable ensureOpen)
-
-
Method Detail
-
writeFileChunk
public void writeFileChunk(StoreFileMetaData fileMetaData, long position, BytesReference content, boolean lastChunk) throws java.io.IOException
- Throws:
java.io.IOException
-
getOpenIndexOutput
public org.apache.lucene.store.IndexOutput getOpenIndexOutput(java.lang.String key)
-
removeOpenIndexOutputs
public org.apache.lucene.store.IndexOutput removeOpenIndexOutputs(java.lang.String name)
remove andIndexOutputfor a given file. It is the caller's responsibility to close it
-
openAndPutIndexOutput
public org.apache.lucene.store.IndexOutput openAndPutIndexOutput(java.lang.String fileName, StoreFileMetaData metaData, Store store) throws java.io.IOExceptionCreates anIndexOutputfor the given file name. Note that the IndexOutput actually point at a temporary file.Note: You can use
getOpenIndexOutput(String)with the same filename to retrieve the same IndexOutput at a later stage- Throws:
java.io.IOException
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceReleasable
-
renameAllTempFiles
public void renameAllTempFiles() throws java.io.IOExceptionrenames all temporary files to their true name, potentially overriding existing files- Throws:
java.io.IOException
-
-