mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
14.20.2021 5e39c0040ddde260831a5b9f73c0bbfec3738f94
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package de.micromata.borgbutler.json.borg;
 
/**
 * Output of borg option <tt>--progress</tt>.
 * See https://borgbackup.readthedocs.io/en/stable/internals/frontends.html,
 */
public class ProgressInfo implements Cloneable {
    // {"message": "Calculating statistics...   0%", "current": 1, "total": 2497, "info": null, "operation": 1, "msgid": null, "type": "progress_percent", "finished": false, "time": 1546640510.116256}
    /**
     * e. g. Calculating statistics...   5%
     */
    private String message;
    /**
     * Current counter of total.
     */
    private long current;
    private long total;
    /**
     * Array that describes the current item, may be null, contents depend on msgid.
     */
    private String[] info;
    /**
     * unique, opaque integer ID of the operation.
     */
    private int operation;
    private String msgid;
    /**
     * e. g. progress_percent
     */
    private String type;
    private boolean finished;
    /**
     * Unix timestamp (float).
     */
    private double time;
 
    public ProgressInfo incrementCurrent() {
        ++current;
        return this;
    }
 
    @Override
    public ProgressInfo clone() {
        ProgressInfo clone = null;
        try {
            clone = (ProgressInfo) super.clone();
        } catch (CloneNotSupportedException ex) {
            throw new UnsupportedOperationException(this.getClass().getCanonicalName() + " isn't cloneable: " + ex.getMessage(), ex);
        }
        return clone;
    }
 
    public String getMessage() {
        return this.message;
    }
 
    public long getCurrent() {
        return this.current;
    }
 
    public long getTotal() {
        return this.total;
    }
 
    public String[] getInfo() {
        return this.info;
    }
 
    public int getOperation() {
        return this.operation;
    }
 
    public String getMsgid() {
        return this.msgid;
    }
 
    public String getType() {
        return this.type;
    }
 
    public boolean isFinished() {
        return this.finished;
    }
 
    public double getTime() {
        return this.time;
    }
 
    public ProgressInfo setMessage(String message) {
        this.message = message;
        return this;
    }
 
    public ProgressInfo setCurrent(long current) {
        this.current = current;
        return this;
    }
 
    public ProgressInfo setTotal(long total) {
        this.total = total;
        return this;
    }
}