blob: a8bfd1ebf688686908cbdf16601d9020f1f51a79 (
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
63
64
65
66
67
68
69
70
|
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.versions;
import com.yahoo.component.Version;
import com.yahoo.component.Vtag;
import org.jetbrains.annotations.NotNull;
import java.time.Instant;
import java.util.Objects;
/**
* A controller's Vespa version and commit details.
*
* @author mpolden
*/
public class ControllerVersion implements Comparable<ControllerVersion> {
/** The current version of this controller */
public static final ControllerVersion CURRENT = new ControllerVersion(Vtag.currentVersion, Vtag.commitSha,
Vtag.commitDate);
private final Version version;
private final String commitSha;
private final Instant commitDate;
public ControllerVersion(Version version, String commitSha, Instant commitDate) {
this.version = Objects.requireNonNull(version);
this.commitSha = Objects.requireNonNull(commitSha);
this.commitDate = Objects.requireNonNull(commitDate);
}
/** Vespa version */
public Version version() {
return version;
}
/** Commit SHA of this */
public String commitSha() {
return commitSha;
}
/** The time this was committed */
public Instant commitDate() {
return commitDate;
}
@Override
public String toString() {
return version + ", commit " + commitSha + " @ " + commitDate;
}
@Override
public int compareTo(@NotNull ControllerVersion o) {
return version.compareTo(o.version);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ControllerVersion that = (ControllerVersion) o;
return version.equals(that.version);
}
@Override
public int hashCode() {
return Objects.hash(version);
}
}
|