org.apache.solr.core

## Class HdfsDirectoryFactory

- java.lang.Object
- - org.apache.solr.core.DirectoryFactory
  - - org.apache.solr.core.CachingDirectoryFactory
    - - org.apache.solr.core.HdfsDirectoryFactory

- All Implemented Interfaces:
    Closeable, AutoCloseable, NamedListInitializedPlugin, SolrCoreAware

      public class HdfsDirectoryFactory
      extends CachingDirectoryFactory
      implements SolrCoreAware

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.solr.core.CachingDirectoryFactory

      `CachingDirectoryFactory.CacheValue, CachingDirectoryFactory.CloseListener`

    - ### Nested classes/interfaces inherited from class org.apache.solr.core.DirectoryFactory

      `DirectoryFactory.DirContext`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BLOCKCACHE_DIRECT_MEMORY_ALLOCATION`
    `static String` | `BLOCKCACHE_ENABLED`
    `static String` | `BLOCKCACHE_GLOBAL`
    `static String` | `BLOCKCACHE_READ_ENABLED`
    `static String` | `BLOCKCACHE_SLAB_COUNT`
    `static String` | `BLOCKCACHE_WRITE_ENABLED`
    `static String` | `CACHE_MERGES`
    `static String` | `CACHE_READONCE`
    `static String` | `CONFIG_DIRECTORY`
    `static String` | `HDFS_HOME`
    `static String` | `KERBEROS_ENABLED`
    `static String` | `KERBEROS_KEYTAB`
    `static String` | `KERBEROS_PRINCIPAL`
    `static String` | `LOCALITYMETRICS_ENABLED`
    `static Metrics` | `metrics`
    `static String` | `NRTCACHINGDIRECTORY_ENABLE`
    `static String` | `NRTCACHINGDIRECTORY_MAXCACHEMB`
    `static String` | `NRTCACHINGDIRECTORY_MAXMERGESIZEMB`
    `static String` | `NUMBEROFBLOCKSPERBANK`

    - ### Fields inherited from class org.apache.solr.core.CachingDirectoryFactory

      `byDirectoryCache, byPathCache, closeListeners, removeEntries`

    - ### Fields inherited from class org.apache.solr.core.DirectoryFactory

      `coreContainer, INDEX_W_TIMESTAMP_REGEX, IOCONTEXT_NO_CACHE, LOCK_TYPE_HDFS, LOCK_TYPE_NATIVE, LOCK_TYPE_NONE, LOCK_TYPE_SIMPLE, LOCK_TYPE_SINGLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HdfsDirectoryFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cleanupOldIndexDirectories(String dataDir, String currentIndexDir)`
    `void` | `close()` Close the this and all of the Directories it contains.
    `protected Directory` | `create(String path, LockFactory lockFactory, DirectoryFactory.DirContext dirContext)` Creates a new Directory for a given path.
    `protected LockFactory` | `createLockFactory(String rawLockType)` Creates a new LockFactory for a given path.
    `boolean` | `exists(String path)` Returns true if a Directory exists for a given path.
    `org.apache.hadoop.conf.Configuration` | `getConf()`
    `String` | `getConfDir()`
    `String` | `getDataHome(CoreDescriptor cd)`
    `void` | `inform(SolrCore core)`
    `void` | `init(NamedList args)`
    `boolean` | `isAbsolute(String path)`
    `boolean` | `isPersistent()`
    `boolean` | `isSharedStorage()`
    `Collection<SolrInfoMBean>` | `offerMBeans()` Optionally allow the DirectoryFactory to request registration of some MBeans.
    `protected void` | `removeDirectory(CachingDirectoryFactory.CacheValue cacheValue)`
    `boolean` | `searchersReserveCommitPoints()` If your implementation can count on delete-on-last-close semantics or throws an exception when trying to remove a file in use, return false (eg NFS).
    `long` | `size(Directory directory)`
    `long` | `size(String path)`

    - ### Methods inherited from class org.apache.solr.core.CachingDirectoryFactory

      `addCloseListener, deleteOldIndexDirectory, doneWithDirectory, get, getLivePaths, getPath, incRef, normalize, release, remove, remove, remove, remove, stripTrailingSlash`

    - ### Methods inherited from class org.apache.solr.core.DirectoryFactory

      `empty, initCoreContainer, move, sizeOf, sizeOfDirectory`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### BLOCKCACHE_SLAB_COUNT

          public static final String BLOCKCACHE_SLAB_COUNT

      See Also:
        Constant Field Values

    - #### BLOCKCACHE_DIRECT_MEMORY_ALLOCATION

          public static final String BLOCKCACHE_DIRECT_MEMORY_ALLOCATION

      See Also:
        Constant Field Values

    - #### BLOCKCACHE_ENABLED

          public static final String BLOCKCACHE_ENABLED

      See Also:
        Constant Field Values

    - #### BLOCKCACHE_GLOBAL

          public static final String BLOCKCACHE_GLOBAL

      See Also:
        Constant Field Values

    - #### BLOCKCACHE_READ_ENABLED

          public static final String BLOCKCACHE_READ_ENABLED

      See Also:
        Constant Field Values

    - #### BLOCKCACHE_WRITE_ENABLED

          public static final String BLOCKCACHE_WRITE_ENABLED

      See Also:
        Constant Field Values

    - #### NRTCACHINGDIRECTORY_ENABLE

          public static final String NRTCACHINGDIRECTORY_ENABLE

      See Also:
        Constant Field Values

    - #### NRTCACHINGDIRECTORY_MAXMERGESIZEMB

          public static final String NRTCACHINGDIRECTORY_MAXMERGESIZEMB

      See Also:
        Constant Field Values

    - #### NRTCACHINGDIRECTORY_MAXCACHEMB

          public static final String NRTCACHINGDIRECTORY_MAXCACHEMB

      See Also:
        Constant Field Values

    - #### NUMBEROFBLOCKSPERBANK

          public static final String NUMBEROFBLOCKSPERBANK

      See Also:
        Constant Field Values

    - #### LOCALITYMETRICS_ENABLED

          public static final String LOCALITYMETRICS_ENABLED

      See Also:
        Constant Field Values

    - #### KERBEROS_ENABLED

          public static final String KERBEROS_ENABLED

      See Also:
        Constant Field Values

    - #### KERBEROS_KEYTAB

          public static final String KERBEROS_KEYTAB

      See Also:
        Constant Field Values

    - #### KERBEROS_PRINCIPAL

          public static final String KERBEROS_PRINCIPAL

      See Also:
        Constant Field Values

    - #### HDFS_HOME

          public static final String HDFS_HOME

      See Also:
        Constant Field Values

    - #### CONFIG_DIRECTORY

          public static final String CONFIG_DIRECTORY

      See Also:
        Constant Field Values

    - #### CACHE_MERGES

          public static final String CACHE_MERGES

      See Also:
        Constant Field Values

    - #### CACHE_READONCE

          public static final String CACHE_READONCE

      See Also:
        Constant Field Values

    - #### metrics

          public static Metrics metrics

  - ### Constructor Detail

    - #### HdfsDirectoryFactory

          public HdfsDirectoryFactory()

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Description copied from class: `DirectoryFactory`
      Close the this and all of the Directories it contains.
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `CachingDirectoryFactory`
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### init

          public void init(NamedList args)

      Specified by:
        `init` in interface `NamedListInitializedPlugin`
      Overrides:
        `init` in class `CachingDirectoryFactory`

    - #### createLockFactory

          protected LockFactory createLockFactory(String rawLockType)
                                           throws IOException

      Description copied from class: `DirectoryFactory`
      Creates a new LockFactory for a given path.
      Specified by:
        `createLockFactory` in class `DirectoryFactory`
      Parameters:
        `rawLockType` - A string value as passed in config. Every factory should at least support 'none' to disable locking.
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### create

          protected Directory create(String path,
                                     LockFactory lockFactory,
                                     DirectoryFactory.DirContext dirContext)
                              throws IOException

      Description copied from class: `DirectoryFactory`
      Creates a new Directory for a given path.
      Specified by:
        `create` in class `DirectoryFactory`
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### exists

          public boolean exists(String path)

      Description copied from class: `DirectoryFactory`
      Returns true if a Directory exists for a given path.
      Overrides:
        `exists` in class `CachingDirectoryFactory`

    - #### getConf

          public org.apache.hadoop.conf.Configuration getConf()

    - #### removeDirectory

          protected void removeDirectory(CachingDirectoryFactory.CacheValue cacheValue)
                                  throws IOException

      Overrides:
        `removeDirectory` in class `CachingDirectoryFactory`
      Throws:
        `IOException`

    - #### isAbsolute

          public boolean isAbsolute(String path)

      Overrides:
        `isAbsolute` in class `DirectoryFactory`
      Parameters:
        `path` - the path to check
      Returns:
        true if absolute, as in not relative

    - #### isPersistent

          public boolean isPersistent()

      Specified by:
        `isPersistent` in class `DirectoryFactory`
      Returns:
        true if data is kept after close.

    - #### isSharedStorage

          public boolean isSharedStorage()

      Overrides:
        `isSharedStorage` in class `DirectoryFactory`
      Returns:
        true if storage is shared.

    - #### searchersReserveCommitPoints

          public boolean searchersReserveCommitPoints()

      Description copied from class: `DirectoryFactory`
      If your implementation can count on delete-on-last-close semantics or throws an exception when trying to remove a file in use, return false (eg NFS). Otherwise, return true. Defaults to returning false.
      Overrides:
        `searchersReserveCommitPoints` in class `DirectoryFactory`
      Returns:
        true if factory impl requires that Searcher's explicitly reserve commit points.

    - #### getDataHome

          public String getDataHome(CoreDescriptor cd)
                             throws IOException

      Overrides:
        `getDataHome` in class `DirectoryFactory`
      Throws:
        `IOException`

    - #### size

          public long size(Directory directory)
                    throws IOException

      Overrides:
        `size` in class `DirectoryFactory`
      Parameters:
        `directory` - to calculate size of
      Returns:
        size in bytes
      Throws:
        `IOException` - on low level IO error

    - #### size

          public long size(String path)
                    throws IOException

      Overrides:
        `size` in class `DirectoryFactory`
      Parameters:
        `path` - to calculate size of
      Returns:
        size in bytes
      Throws:
        `IOException` - on low level IO error

    - #### getConfDir

          public String getConfDir()

    - #### offerMBeans

          public Collection<SolrInfoMBean> offerMBeans()

      Description copied from class: `DirectoryFactory`
      Optionally allow the DirectoryFactory to request registration of some MBeans.
      Overrides:
        `offerMBeans` in class `DirectoryFactory`

    - #### inform

          public void inform(SolrCore core)

      Specified by:
        `inform` in interface `SolrCoreAware`

    - #### cleanupOldIndexDirectories

          public void cleanupOldIndexDirectories(String dataDir,
                                                 String currentIndexDir)

      Overrides:
        `cleanupOldIndexDirectories` in class `DirectoryFactory`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.