Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-3314 Rework access to per-index resources (write orchestrator…
…, readers) to prepare for sharding Essentially we will need a design that allows work executors and queries to dynamically retrieve a list of resources based on a set of strings, so we can't just pass these resources directly to the work executors/queries.
- Loading branch information
Showing
15 changed files
with
184 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ava/org/hibernate/search/backend/lucene/lowlevel/reader/impl/ReadIndexManagerContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.backend.lucene.lowlevel.reader.impl; | ||
|
||
import org.hibernate.search.backend.lucene.index.spi.ReaderProvider; | ||
|
||
/** | ||
* An interface with knowledge of the index manager internals, | ||
* able to retrieve components related to index reading. | ||
*/ | ||
public interface ReadIndexManagerContext extends ReaderProvider { | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
.../main/java/org/hibernate/search/backend/lucene/lowlevel/reader/spi/IndexReaderHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.backend.lucene.lowlevel.reader.spi; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
|
||
import org.apache.lucene.index.IndexReader; | ||
|
||
public interface IndexReaderHolder extends Closeable { | ||
|
||
/** | ||
* Release any resource currently held by the {@link IndexReaderHolder}, | ||
* including (but not limiting to) the reader itself. | ||
* <p> | ||
* After this method has been called, the result of calling any other method on the same instance is undefined. | ||
* | ||
* @throws IOException If an error occurs while releasing resources. | ||
* @throws RuntimeException If an error occurs while releasing resources. | ||
*/ | ||
@Override | ||
void close() throws IOException; | ||
|
||
/** | ||
* @return The reader held by this {@link IndexReaderHolder}. | ||
*/ | ||
IndexReader get(); | ||
|
||
/** | ||
* @param indexReader The {@link IndexReader} to hold. | ||
* @return An {@link IndexReaderHolder} that returns the given directory when {@link #get()} is called | ||
* and simply closes the directory when {@link #close()} is called. | ||
*/ | ||
static IndexReaderHolder of(IndexReader indexReader) { | ||
return new SimpleIndexReaderHolder( indexReader ); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...java/org/hibernate/search/backend/lucene/lowlevel/reader/spi/SimpleIndexReaderHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.backend.lucene.lowlevel.reader.spi; | ||
|
||
import java.io.IOException; | ||
|
||
import org.apache.lucene.index.IndexReader; | ||
|
||
final class SimpleIndexReaderHolder implements IndexReaderHolder { | ||
private final IndexReader indexReader; | ||
|
||
SimpleIndexReaderHolder(IndexReader indexReader) { | ||
this.indexReader = indexReader; | ||
} | ||
|
||
@Override | ||
public IndexReader get() { | ||
return indexReader; | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
indexReader.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.