aboutsummaryrefslogtreecommitdiffstats
path: root/configserver/src/main/java/com/yahoo/vespa/config/server/configchange/ConfigChangeActions.java
blob: db3f44aa59e425640ef8e30afb3fc2fea6ba56c4 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.configchange;

import com.yahoo.config.model.api.ConfigChangeAction;

import java.util.List;
import java.util.Objects;

/**
 * Contains an aggregated view of which actions that must be performed to handle config
 * changes between the current active model and the next model to prepare.
 * The actions are split into restart and re-feed actions.
 *
 * @author geirst
 */
public class ConfigChangeActions {

    private final RestartActions restartActions;
    private final RefeedActions refeedActions;
    private final ReindexActions reindexActions;

    public ConfigChangeActions() {
        this(new RestartActions(), new RefeedActions(), new ReindexActions());
    }

    public ConfigChangeActions(List<ConfigChangeAction> actions) {
        this(new RestartActions(actions), new RefeedActions(actions), new ReindexActions(actions));
    }

    public ConfigChangeActions(RestartActions restartActions, RefeedActions refeedActions, ReindexActions reindexActions) {
        this.restartActions = Objects.requireNonNull(restartActions);
        this.refeedActions = Objects.requireNonNull(refeedActions);
        this.reindexActions = Objects.requireNonNull(reindexActions);
    }

    public ConfigChangeActions withRestartActions(RestartActions restartActions) {
        return new ConfigChangeActions(restartActions, refeedActions, reindexActions);
    }

    public RestartActions getRestartActions() {
        return restartActions;
    }

    public RefeedActions getRefeedActions() {
        return refeedActions;
    }

    public ReindexActions getReindexActions() { return reindexActions; }

}