Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      We have a few DirectoryWrapper implementations such as RateLimitedDirectoryWrapper and MockDirectoryWrapper. However, the Directory class is not straightforward to wrap since it already has logic for getting and setting the lock factory, so wrappers need to decide whether they should forward lock handling to the delegate or handle it themselves.

      I would like to move the locking logic out of the Directory class and to have a base FilterDirectory that could be extended by other directory wrapper impls.

      1. LUCENE-5204.patch
        37 kB
        Adrien Grand
      2. LUCENE-5204.patch
        39 kB
        Adrien Grand

        Activity

        Hide
        ASF subversion and git services added a comment -

        Commit 1522665 from Adrien Grand in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1522665 ]

        LUCENE-5204: Make Directory easier to wrap.

        Show
        ASF subversion and git services added a comment - Commit 1522665 from Adrien Grand in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1522665 ] LUCENE-5204 : Make Directory easier to wrap.
        Hide
        ASF subversion and git services added a comment -

        Commit 1522661 from Adrien Grand in branch 'dev/trunk'
        [ https://svn.apache.org/r1522661 ]

        LUCENE-5204: Make Directory easier to wrap.

        Show
        ASF subversion and git services added a comment - Commit 1522661 from Adrien Grand in branch 'dev/trunk' [ https://svn.apache.org/r1522661 ] LUCENE-5204 : Make Directory easier to wrap.
        Hide
        Adrien Grand added a comment -

        New patch which makes FilterDirectory @lucene.internal, BaseDirectory @lucene.experimental and adds extra warnings on the FilterDirectory class to discourage its use.

        Show
        Adrien Grand added a comment - New patch which makes FilterDirectory @lucene.internal, BaseDirectory @lucene.experimental and adds extra warnings on the FilterDirectory class to discourage its use.
        Hide
        Robert Muir added a comment -

        Or at least mark it internal with a huge huge huge warning, thats ok too. I just think all these delegators are going to bite us bigtime.

        Show
        Robert Muir added a comment - Or at least mark it internal with a huge huge huge warning, thats ok too. I just think all these delegators are going to bite us bigtime.
        Hide
        Robert Muir added a comment -

        Can we make FilterDirectory package-private?

        I know we have done this FilterXXX strategy with other apis, but delegating over an abstract class is always broken by definition... Its a little scary to expose this as a "supported API" for directory.

        Show
        Robert Muir added a comment - Can we make FilterDirectory package-private? I know we have done this FilterXXX strategy with other apis, but delegating over an abstract class is always broken by definition... Its a little scary to expose this as a "supported API" for directory.
        Hide
        Adrien Grand added a comment -

        Here is a patch:

        • the LockFactory-related methods are now abstract in Directory, impls have been moved to BaseDirectory, which is the base class for all concrete implementations (RAMDirectory, FSDirectories, etc.).
        • FilterDirectory extends Directory and implements all methods that don't have a default implementation in Directory.
        • BaseDirectoryWrapper, RateLimitedDirectoryWrapper and TrackingDirectoryWrapper now extend FilterDirectory, only overriding what's necessary.
        Show
        Adrien Grand added a comment - Here is a patch: the LockFactory-related methods are now abstract in Directory, impls have been moved to BaseDirectory, which is the base class for all concrete implementations (RAMDirectory, FSDirectories, etc.). FilterDirectory extends Directory and implements all methods that don't have a default implementation in Directory. BaseDirectoryWrapper, RateLimitedDirectoryWrapper and TrackingDirectoryWrapper now extend FilterDirectory, only overriding what's necessary.

          People

          • Assignee:
            Adrien Grand
            Reporter:
            Adrien Grand
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development