aboutsummaryrefslogtreecommitdiffstats
path: root/config-model-api/src/main/java/com/yahoo/config/model/api/Reindexing.java
blob: b1164709bfc66735bb4da79380f8979ca1dcdfb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.api;

import java.time.Instant;
import java.util.Optional;

/**
 * Status of reindexing for the documents of an application.
 *
 * @author jonmv
 */
public interface Reindexing {

    /** Reindexing status for this application, for a given cluster and document type. */
    default Optional<Status> status(String cluster, String documentType) { return Optional.empty(); }

    /** Returns whether reindexing should run for this application. */
    default boolean enabled() { return false; }

    /** Reindexing status of a given document type in a given cluster in a given application. */
    interface Status {

        /** The instant at which reindexing may begin. */
        Instant ready();

        /** The relative speed with which to reindex. */
        double speed();

        /** The cause of reindexing for this document type. */
        String cause();

    }

    Reindexing DISABLED_INSTANCE = new Reindexing() {};

}