Class MultiFileWriter
java.lang.Object
org.elasticsearch.core.AbstractRefCounted
org.elasticsearch.indices.recovery.MultiFileWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,org.elasticsearch.core.RefCounted,org.elasticsearch.core.Releasable
public class MultiFileWriter
extends org.elasticsearch.core.AbstractRefCounted
implements org.elasticsearch.core.Releasable
-
Constructor Summary
ConstructorsConstructorDescriptionMultiFileWriter(Store store, RecoveryState.Index indexState, String tempFilePrefix, org.apache.logging.log4j.Logger logger, Runnable ensureOpen) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidorg.apache.lucene.store.IndexOutputgetOpenIndexOutput(String key)org.apache.lucene.store.IndexOutputopenAndPutIndexOutput(String fileName, StoreFileMetadata metadata, Store store)Creates anIndexOutputfor the given file name.org.apache.lucene.store.IndexOutputremoveOpenIndexOutputs(String name)remove andIndexOutputfor a given file.voidrenames all temporary files to their true name, potentially overriding existing filesvoidwriteFileChunk(StoreFileMetadata fileMetadata, long position, ReleasableBytesReference content, boolean lastChunk)Methods inherited from class org.elasticsearch.core.AbstractRefCounted
alreadyClosed, decRef, getName, incRef, refCount, touch, tryIncRef
-
Constructor Details
-
MultiFileWriter
public MultiFileWriter(Store store, RecoveryState.Index indexState, String tempFilePrefix, org.apache.logging.log4j.Logger logger, Runnable ensureOpen)
-
-
Method Details
-
writeFileChunk
public void writeFileChunk(StoreFileMetadata fileMetadata, long position, ReleasableBytesReference content, boolean lastChunk) throws IOException- Throws:
IOException
-
getOpenIndexOutput
-
removeOpenIndexOutputs
remove andIndexOutputfor a given file. It is the caller's responsibility to close it -
openAndPutIndexOutput
public org.apache.lucene.store.IndexOutput openAndPutIndexOutput(String fileName, StoreFileMetadata metadata, Store store) throws 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:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.elasticsearch.core.Releasable
-
closeInternal
protected void closeInternal()- Specified by:
closeInternalin classorg.elasticsearch.core.AbstractRefCounted
-
renameAllTempFiles
renames all temporary files to their true name, potentially overriding existing files- Throws:
IOException
-