@Named(value="default") @Singleton public class SearchIndexServiceImpl extends org.sonatype.goodies.common.ComponentSupport implements SearchIndexService
SearchIndexService
implementation.Constructor and Description |
---|
SearchIndexServiceImpl(javax.inject.Provider<org.elasticsearch.client.Client> client,
IndexNamingPolicy indexNamingPolicy,
List<IndexSettingsContributor> indexSettingsContributors,
org.sonatype.nexus.common.event.EventManager eventManager,
int bulkCapacity,
int concurrentRequests,
int flushInterval,
int calmTimeout,
int batchingThreads) |
Modifier and Type | Method and Description |
---|---|
void |
bulkDelete(org.sonatype.nexus.repository.Repository repository,
Iterable<String> identifiers)
Operation used for bulk removal of data from index of given repository.
|
<T> List<Future<Void>> |
bulkPut(org.sonatype.nexus.repository.Repository repository,
Iterable<T> components,
Function<T,String> identifierProducer,
Function<T,String> jsonDocumentProducer)
Operation used for bulk updating of component index.
|
void |
createIndex(org.sonatype.nexus.repository.Repository repository)
Create index for specified repository, if does not already exits.
|
void |
delete(org.sonatype.nexus.repository.Repository repository,
String identifier)
Removes data with given identifier from index of given repository.
|
void |
deleteIndex(org.sonatype.nexus.repository.Repository repository)
Deletes index for specified repository.
|
void |
flush(boolean fsync)
Flush any pending bulk index requests.
|
long |
getUpdateCount()
Used by ITs to check the frequency of search updates.
|
boolean |
indexExist(org.sonatype.nexus.repository.Repository repository)
Check search index exists for specific repository
|
boolean |
isCalmPeriod()
Used by UTs and ITs only to "wait for calm period" when all search indexing is finished.
|
void |
put(org.sonatype.nexus.repository.Repository repository,
String identifier,
String json)
Puts data with given identifier into index of given repository.
|
void |
rebuildIndex(org.sonatype.nexus.repository.Repository repository)
Rebuilds index for specific repository.
|
void |
waitForCalm()
Wait for a calm period where no search indexing is happening.
|
@Inject public SearchIndexServiceImpl(javax.inject.Provider<org.elasticsearch.client.Client> client, IndexNamingPolicy indexNamingPolicy, List<IndexSettingsContributor> indexSettingsContributors, org.sonatype.nexus.common.event.EventManager eventManager, @Named(value="${nexus.elasticsearch.bulkCapacity:-1000}") int bulkCapacity, @Named(value="${nexus.elasticsearch.concurrentRequests:-1}") int concurrentRequests, @Named(value="${nexus.elasticsearch.flushInterval:-0}") int flushInterval, @Named(value="${nexus.elasticsearch.calmTimeout:-3000}") int calmTimeout, @Named(value="${nexus.elasticsearch.batching.threads.count:-1}") int batchingThreads)
client
- source for a Client
indexNamingPolicy
- the index naming policyindexSettingsContributors
- the index settings contributorseventManager
- the event managerbulkCapacity
- how many bulk requests to batch before they're automatically flushed (default: 1000)concurrentRequests
- how many bulk requests to execute concurrently (default: 1; 0 means execute synchronously)flushInterval
- how long to wait in milliseconds between flushing bulk requests (default: 0, instantaneous)calmTimeout
- timeout in ms to wait for a calm periodbatchingThreads
- This is the number of threads 'n' batching up index updates into 'n' BulkProcessors.
That is, the number of independent batches to accumulate index updates in.public void createIndex(org.sonatype.nexus.repository.Repository repository)
SearchIndexService
createIndex
in interface SearchIndexService
public void deleteIndex(org.sonatype.nexus.repository.Repository repository)
SearchIndexService
deleteIndex
in interface SearchIndexService
public void rebuildIndex(org.sonatype.nexus.repository.Repository repository)
SearchIndexService
rebuildIndex
in interface SearchIndexService
public boolean indexExist(org.sonatype.nexus.repository.Repository repository)
SearchIndexService
indexExist
in interface SearchIndexService
public void put(org.sonatype.nexus.repository.Repository repository, String identifier, String json)
SearchIndexService
put
in interface SearchIndexService
public <T> List<Future<Void>> bulkPut(org.sonatype.nexus.repository.Repository repository, Iterable<T> components, Function<T,String> identifierProducer, Function<T,String> jsonDocumentProducer)
SearchIndexService
bulkPut
in interface SearchIndexService
repository
- the source repositorycomponents
- an Iterable
of components to indexidentifierProducer
- a function producing an identifier for a component (never returning null)jsonDocumentProducer
- a function producing a json document for the component (never returning null)public void delete(org.sonatype.nexus.repository.Repository repository, String identifier)
SearchIndexService
delete
in interface SearchIndexService
public void bulkDelete(@Nullable org.sonatype.nexus.repository.Repository repository, Iterable<String> identifiers)
SearchIndexService
bulkDelete
in interface SearchIndexService
repository
- the source repository (if known)identifiers
- the ids of documents to removepublic void flush(boolean fsync)
SearchIndexService
flush
in interface SearchIndexService
public long getUpdateCount()
SearchIndexService
getUpdateCount
in interface SearchIndexService
public boolean isCalmPeriod()
SearchIndexService
isCalmPeriod
in interface SearchIndexService
public void waitForCalm()
SearchIndexService
waitForCalm
in interface SearchIndexService
Copyright © 2008–2021 Sonatype, Inc.. All rights reserved.