Class DistributorDirectory

  • All Implemented Interfaces:
    Closeable, AutoCloseable


    public final class DistributorDirectory
    extends org.apache.lucene.store.BaseDirectory
    A directory implementation that uses the Elasticsearch Distributor abstraction to distribute files across multiple data directories.
    • Field Summary

      • Fields inherited from class org.apache.lucene.store.BaseDirectory

        isOpen, lockFactory
    • Constructor Summary

      Constructors

      Constructor and Description
      DistributorDirectory(org.apache.lucene.store.Directory... dirs)
      Creates a new DistributorDirectory from multiple directories.
      DistributorDirectory(Distributor distributor)
      Creates a new DistributorDirectory form the given Distributor.
    • Constructor Detail

      • DistributorDirectory

        public DistributorDirectory(org.apache.lucene.store.Directory... dirs)
                             throws IOException
        Creates a new DistributorDirectory from multiple directories. Note: The first directory in the given array is used as the primary directory holding the file locks as well as the SEGMENTS_GEN file. All remaining directories are used in a round robin fashion.
        Throws:
        IOException
      • DistributorDirectory

        public DistributorDirectory(Distributor distributor)
                             throws IOException
        Creates a new DistributorDirectory form the given Distributor.
        Throws:
        IOException
    • Method Detail

      • listAll

        public final String[] listAll()
                               throws IOException
        Specified by:
        listAll in class  org.apache.lucene.store.Directory
        Throws:
        IOException
      • fileExists

        public boolean fileExists(String name)
                           throws IOException
        Specified by:
        fileExists in class  org.apache.lucene.store.Directory
        Throws:
        IOException
      • deleteFile

        public void deleteFile(String name)
                        throws IOException
        Specified by:
        deleteFile in class  org.apache.lucene.store.Directory
        Throws:
        IOException
      • fileLength

        public long fileLength(String name)
                        throws IOException
        Specified by:
        fileLength in class  org.apache.lucene.store.Directory
        Throws:
        IOException
      • createOutput

        public org.apache.lucene.store.IndexOutput createOutput(String name,
                                                                org.apache.lucene.store.IOContext context)
                                                         throws IOException
        Specified by:
        createOutput in class  org.apache.lucene.store.Directory
        Throws:
        IOException
      • openInput

        public org.apache.lucene.store.IndexInput openInput(String name,
                                                            org.apache.lucene.store.IOContext context)
                                                     throws IOException
        Specified by:
        openInput in class  org.apache.lucene.store.Directory
        Throws:
        IOException
      • setLockFactory

        public void setLockFactory(org.apache.lucene.store.LockFactory lockFactory)
                            throws IOException
        Overrides:
        setLockFactory in class  org.apache.lucene.store.BaseDirectory
        Throws:
        IOException
      • getLockID

        public String getLockID()
      • toString

        public String toString()
      • renameFile

        public void renameFile(DirectoryService directoryService,
                               String source,
                               String dest)
                        throws IOException
        Renames the given source file to the given target file unless the target already exists.
        Parameters:
        directoryService - the DirectoryService to use.
        source - the source file name.
        dest - the target file name
        Throws:
        IOException - if the target file already exists.