aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ServiceConvergence.java
blob: f0ed73c2dc9a0bd0a05e804b9f38cd0b5545c364 (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
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.configserver;

import com.google.common.collect.ImmutableList;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.zone.ZoneId;

import java.util.List;

/**
 * Service convergence status for an application.
 *
 * @author mpolden
 * @author jonmv
 */
public class ServiceConvergence {

    private final ApplicationId application;
    private final ZoneId zone;
    private final boolean converged;
    private final long wantedGeneration;
    private final List<Status> services;

    public ServiceConvergence(ApplicationId application, ZoneId zone, boolean converged,
                              long wantedGeneration, List<Status> services) {
        this.application = application;
        this.zone = zone;
        this.converged = converged;
        this.wantedGeneration = wantedGeneration;
        this.services = ImmutableList.copyOf(services);
    }

    public ApplicationId application() { return application; }
    public ZoneId zone() { return zone; }
    public boolean converged() { return converged; }
    public long wantedGeneration() { return wantedGeneration; }
    public List<Status> services() { return services; }


    /** Immutable class detailing the config status of a particular service for an application. */
    public static class Status {
        private final HostName host;
        private final long port;
        private final String type;
        private final long currentGeneration;

        public Status(HostName host, long port, String type, long currentGeneration) {
            this.host = host;
            this.port = port;
            this.type = type;
            this.currentGeneration = currentGeneration;
        }

        public HostName host() { return host; }
        public long port() { return port; }
        public String type() { return type; }
        public long currentGeneration() { return currentGeneration; }

    }

}