View Javadoc
1   package ca.uhn.fhir.jpa.search.reindex;
2   
3   /*-
4    * #%L
5    * HAPI FHIR JPA Server
6    * %%
7    * Copyright (C) 2014 - 2019 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   *
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  public interface IResourceReindexingSvc {
24  
25  	/**
26  	 * Marks all indexes as needing fresh indexing
27  	 *
28  	 * @return Returns the job ID
29  	 */
30  	Long markAllResourcesForReindexing();
31  
32  	/**
33  	 * Marks all indexes of the given type as needing fresh indexing
34  	 *
35  	 * @return Returns the job ID
36  	 */
37  	Long markAllResourcesForReindexing(String theType);
38  
39  	/**
40  	 * Called automatically by the job scheduler
41  	 */
42  	void scheduleReindexingPass();
43  
44  	/**
45  	 * @return Returns null if the system did not attempt to perform a pass because one was
46  	 * already proceeding. Otherwise, returns the number of resources affected.
47  	 */
48  	Integer runReindexingPass();
49  
50  	/**
51  	 * Does the same thing as {@link #runReindexingPass()} but makes sure to perform at
52  	 * least one pass even if one is half finished
53  	 */
54  	int forceReindexingPass();
55  
56  	/**
57  	 * Cancels all running and future reindexing jobs. This is mainly intended
58  	 * to be used by unit tests.
59  	 */
60  	void cancelAndPurgeAllJobs();
61  
62  	int countReindexJobs();
63  }