Class MultiFileWriter

java.lang.Object
org.elasticsearch.common.util.concurrent.AbstractRefCounted
org.elasticsearch.indices.recovery.MultiFileWriter
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable, Releasable, org.elasticsearch.common.util.concurrent.RefCounted

public class MultiFileWriter
extends org.elasticsearch.common.util.concurrent.AbstractRefCounted
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
    void close()  
    protected void closeInternal()  
    org.apache.lucene.store.IndexOutput getOpenIndexOutput​(java.lang.String key)  
    org.apache.lucene.store.IndexOutput openAndPutIndexOutput​(java.lang.String fileName, StoreFileMetadata metadata, Store store)
    Creates an IndexOutput for the given file name.
    org.apache.lucene.store.IndexOutput removeOpenIndexOutputs​(java.lang.String name)
    remove and IndexOutput for a given file.
    void renameAllTempFiles()
    renames all temporary files to their true name, potentially overriding existing files
    void writeFileChunk​(StoreFileMetadata fileMetadata, long position, ReleasableBytesReference content, boolean lastChunk)  

    Methods inherited from class org.elasticsearch.common.util.concurrent.AbstractRefCounted

    alreadyClosed, decRef, getName, incRef, refCount, tryIncRef

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MultiFileWriter

      public MultiFileWriter​(Store store, RecoveryState.Index indexState, java.lang.String tempFilePrefix, org.apache.logging.log4j.Logger logger, java.lang.Runnable ensureOpen)
  • Method Details

    • writeFileChunk

      public void writeFileChunk​(StoreFileMetadata fileMetadata, long position, ReleasableBytesReference 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 and IndexOutput for 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.IOException
      Creates an IndexOutput 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:
      java.io.IOException
    • close

      public void close()
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Specified by:
      close in interface Releasable
    • closeInternal

      protected void closeInternal()
      Specified by:
      closeInternal in class org.elasticsearch.common.util.concurrent.AbstractRefCounted
    • renameAllTempFiles

      public void renameAllTempFiles() throws java.io.IOException
      renames all temporary files to their true name, potentially overriding existing files
      Throws:
      java.io.IOException