Class MultiFileWriter
- java.lang.Object
-
- org.elasticsearch.indices.recovery.MultiFileWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Releasable
public class MultiFileWriter extends Object implements Releasable
-
-
Constructor Summary
Constructors Constructor Description MultiFileWriter(Store store, RecoveryState.Index indexState, String tempFilePrefix, org.apache.logging.log4j.Logger logger, Runnable ensureOpen)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()IndexOutputgetOpenIndexOutput(String key)IndexOutputopenAndPutIndexOutput(String fileName, StoreFileMetaData metaData, Store store)Creates anIndexOutputfor the given file name.IndexOutputremoveOpenIndexOutputs(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, String tempFilePrefix, org.apache.logging.log4j.Logger logger, Runnable ensureOpen)
-
-
Method Detail
-
writeFileChunk
public void writeFileChunk(StoreFileMetaData fileMetaData, long position, BytesReference content, boolean lastChunk) throws IOException
- Throws:
IOException
-
getOpenIndexOutput
public IndexOutput getOpenIndexOutput(String key)
-
removeOpenIndexOutputs
public IndexOutput removeOpenIndexOutputs(String name)
remove andIndexOutputfor a given file. It is the caller's responsibility to close it
-
openAndPutIndexOutput
public IndexOutput openAndPutIndexOutput(String fileName, StoreFileMetaData metaData, Store store) throws IOException
Creates 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:
IOException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable
-
renameAllTempFiles
public void renameAllTempFiles() throws IOExceptionrenames all temporary files to their true name, potentially overriding existing files- Throws:
IOException
-
-