org.apache.lucene.replicator

## Class PerSessionDirectoryFactory

- java.lang.Object
- - org.apache.lucene.replicator.PerSessionDirectoryFactory

- All Implemented Interfaces:
    ReplicationClient.SourceDirectoryFactory

      public class PerSessionDirectoryFactory
      extends Object
      implements ReplicationClient.SourceDirectoryFactory

  A `ReplicationClient.SourceDirectoryFactory` which returns `FSDirectory` under a dedicated session directory. When a session is over, the entire directory is deleted.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PerSessionDirectoryFactory(Path workDir)` Constructor with the given sources mapping.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cleanupSession(String sessionID)` Called to denote that the replication actions for this session were finished and the directory is no longer needed.
    `Directory` | `getDirectory(String sessionID, String source)` Returns the `Directory` to use for the given session and source.

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

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

- - ### Constructor Detail

    - #### PerSessionDirectoryFactory

          public PerSessionDirectoryFactory(Path workDir)

      Constructor with the given sources mapping.

  - ### Method Detail

    - #### getDirectory

          public Directory getDirectory(String sessionID,
                                        String source)
                                 throws IOException

      Description copied from interface: `ReplicationClient.SourceDirectoryFactory`
      Returns the `Directory` to use for the given session and source. Implementations may e.g. return different directories for different sessions, or the same directory for all sessions. In that case, it is advised to clean the directory before it is used for a new session.
      Specified by:
        `getDirectory` in interface `ReplicationClient.SourceDirectoryFactory`
      Throws:
        `IOException`
      See Also:
        `ReplicationClient.SourceDirectoryFactory.cleanupSession(String)`

    - #### cleanupSession

          public void cleanupSession(String sessionID)
                              throws IOException

      Description copied from interface: `ReplicationClient.SourceDirectoryFactory`
      Called to denote that the replication actions for this session were finished and the directory is no longer needed.
      Specified by:
        `cleanupSession` in interface `ReplicationClient.SourceDirectoryFactory`
      Throws:
        `IOException`

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