001/*-
002 * #%L
003 * HAPI FHIR JPA Server
004 * %%
005 * Copyright (C) 2014 - 2024 Smile CDR, Inc.
006 * %%
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 * #L%
019 */
020package ca.uhn.fhir.jpa.search.reindex;
021
022import ca.uhn.fhir.batch2.model.JobInstanceStartRequest;
023
024/**
025 * @deprecated Use the Batch2 {@link ca.uhn.fhir.batch2.api.IJobCoordinator#startInstance(JobInstanceStartRequest)} instead.
026 */
027public interface IResourceReindexingSvc {
028
029        /**
030         * Marks all indexes as needing fresh indexing
031         *
032         * @return Returns the job ID
033         */
034        Long markAllResourcesForReindexing();
035
036        /**
037         * Marks all indexes of the given type as needing fresh indexing
038         *
039         * @return Returns the job ID
040         */
041        Long markAllResourcesForReindexing(String theType);
042
043        /**
044         * @return Returns null if the system did not attempt to perform a pass because one was
045         * already proceeding. Otherwise, returns the number of resources affected.
046         */
047        Integer runReindexingPass();
048
049        /**
050         * Does the same thing as {@link #runReindexingPass()} but makes sure to perform at
051         * least one pass even if one is half finished
052         */
053        int forceReindexingPass();
054
055        /**
056         * Cancels all running and future reindexing jobs. This is mainly intended
057         * to be used by unit tests.
058         */
059        void cancelAndPurgeAllJobs();
060
061        int countReindexJobs();
062}