java.lang.Object
org.elasticsearch.core.AbstractRefCounted
org.elasticsearch.indices.recovery.MultiFileWriter
- All Implemented Interfaces:
Closeable
,AutoCloseable
,RefCounted
,Releasable
-
Field Summary
Fields inherited from class org.elasticsearch.core.AbstractRefCounted
ALREADY_CLOSED_MESSAGE, INVALID_DECREF_MESSAGE
Fields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED
-
Constructor Summary
ConstructorsConstructorDescriptionMultiFileWriter
(Store store, RecoveryState.Index indexState, String tempFilePrefix, org.apache.logging.log4j.Logger logger) MultiFileWriter
(Store store, RecoveryState.Index indexState, String tempFilePrefix, org.apache.logging.log4j.Logger logger, boolean verifyOutput) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
org.apache.lucene.store.IndexOutput
getOpenIndexOutput
(String key) org.apache.lucene.store.IndexOutput
openAndPutIndexOutput
(String fileName, StoreFileMetadata metadata, Store store) Creates anIndexOutput
for the given file name.org.apache.lucene.store.IndexOutput
removeOpenIndexOutputs
(String name) remove andIndexOutput
for a given file.void
renames all temporary files to their true name, potentially overriding existing filesvoid
writeFile
(StoreFileMetadata fileMetadata, long readSnapshotFileBufferSize, InputStream stream) void
writeFileChunk
(StoreFileMetadata fileMetadata, long position, ReleasableBytesReference content, boolean lastChunk) Methods inherited from class org.elasticsearch.core.AbstractRefCounted
alreadyClosed, decRef, hasReferences, incRef, mustIncRef, of, refCount, touch, tryIncRef
-
Constructor Details
-
MultiFileWriter
public MultiFileWriter(Store store, RecoveryState.Index indexState, String tempFilePrefix, org.apache.logging.log4j.Logger logger) -
MultiFileWriter
public MultiFileWriter(Store store, RecoveryState.Index indexState, String tempFilePrefix, org.apache.logging.log4j.Logger logger, boolean verifyOutput)
-
-
Method Details
-
writeFileChunk
public void writeFileChunk(StoreFileMetadata fileMetadata, long position, ReleasableBytesReference content, boolean lastChunk) throws IOException - Throws:
IOException
-
writeFile
public void writeFile(StoreFileMetadata fileMetadata, long readSnapshotFileBufferSize, InputStream stream) throws IOException - Throws:
IOException
-
getOpenIndexOutput
-
removeOpenIndexOutputs
remove andIndexOutput
for 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 IOException Creates anIndexOutput
for 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceReleasable
-
closeInternal
protected void closeInternal()- Specified by:
closeInternal
in classAbstractRefCounted
-
renameAllTempFiles
renames all temporary files to their true name, potentially overriding existing files- Throws:
IOException
-