summaryrefslogtreecommitdiffstats
path: root/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/Policy.java
blob: 61f05efa9c10d1d80bb4807ee6e1611a35136f4b (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.orchestrator.policy;

import com.yahoo.vespa.applicationmodel.ApplicationInstance;
import com.yahoo.vespa.applicationmodel.HostName;
import com.yahoo.vespa.orchestrator.model.ApplicationApi;
import com.yahoo.vespa.orchestrator.status.MutableStatusRegistry;
import com.yahoo.vespa.service.monitor.ServiceMonitorStatus;

/**
 * @author oyving
 */
public interface Policy {

    /**
     * Decide whether to grant a request for temporarily suspending the services on a host.
     *
     * @throws HostStateChangeDeniedException if the grant was not given.
     */
    void grantSuspensionRequest(
            ApplicationInstance<ServiceMonitorStatus> applicationInstance,
            HostName hostName,
            MutableStatusRegistry hostStatusService) throws HostStateChangeDeniedException;

    /**
     * Decide whether to grant a request for temporarily suspending the services on all hosts in the group.
     */
    void grantSuspensionRequest(ApplicationApi applicationApi) throws HostStateChangeDeniedException;

    void releaseSuspensionGrant(ApplicationApi application) throws HostStateChangeDeniedException;

    /**
     * Give all hosts in a group permission to be removed from the application.
     *
     * @param applicationApi
     */
    void acquirePermissionToRemove(ApplicationApi applicationApi) throws HostStateChangeDeniedException;

    /**
     * Release an earlier grant for suspension.
     *
     * @throws HostStateChangeDeniedException if the release failed.
     */
    void releaseSuspensionGrant(
            ApplicationInstance<ServiceMonitorStatus> applicationInstance,
            HostName hostName,
            MutableStatusRegistry hostStatusService) throws HostStateChangeDeniedException;
}