aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/reports/DropDocumentsReport.java
blob: 2bc8bea013aed5fb8c6c728f16575beea6de1999 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.configserver.noderepository.reports;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * @author freva
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DropDocumentsReport extends BaseReport {
    private static final String REPORT_ID = "dropDocuments";
    private static final String DROPPED_AT_FIELD = "droppedAt";
    private static final String READIED_AT_FIELD = "readiedAt";
    private static final String STARTED_AT_FIELD = "startedAt";

    private final Long droppedAt;
    private final Long readiedAt;
    private final Long startedAt;

    public DropDocumentsReport(@JsonProperty(CREATED_FIELD) Long createdMillisOrNull,
                               @JsonProperty(DROPPED_AT_FIELD) Long droppedAtOrNull,
                               @JsonProperty(READIED_AT_FIELD) Long readiedAtOrNull,
                               @JsonProperty(STARTED_AT_FIELD) Long startedAtOrNull) {
        super(createdMillisOrNull, null);
        this.droppedAt = droppedAtOrNull;
        this.readiedAt = readiedAtOrNull;
        this.startedAt = startedAtOrNull;
    }

    @JsonGetter(DROPPED_AT_FIELD)
    public Long droppedAt() { return droppedAt; }

    @JsonGetter(READIED_AT_FIELD)
    public Long readiedAt() { return readiedAt; }

    @JsonGetter(STARTED_AT_FIELD)
    public Long startedAt() { return startedAt; }

    public DropDocumentsReport withDroppedAt(long droppedAt) {
        return new DropDocumentsReport(getCreatedMillisOrNull(), droppedAt, readiedAt, startedAt);
    }

    public DropDocumentsReport withStartedAt(long startedAt) {
        return new DropDocumentsReport(getCreatedMillisOrNull(), droppedAt, readiedAt, startedAt);
    }

    public static String reportId() {
        return REPORT_ID;
    }

}