summaryrefslogtreecommitdiffstats
path: root/persistence/src/main/java/com/yahoo/persistence/spi/result/UpdateResult.java
blob: 5906411d594ba2e269b717a927d7cf3ac5fe144a (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.persistence.spi.result;

import com.yahoo.persistence.spi.BucketInfo;

/**
 * Result class for update operations.
 */
public class UpdateResult extends Result {
    long existingTimestamp = 0;

    /**
     * Constructor to use when an error occurred during the update
     *
     * @param error The type of error that occurred
     * @param message A human readable message further detailing the error.
     */
    public UpdateResult(ErrorType error, String message) {
        super(error, message);
    }

    /**
     * Constructor to use when the document to update was not found.
     */
    public UpdateResult() {
        super();
    }

    /**
     * Constructor to use when the update was successful.
     *
     * @param existingTimestamp The timestamp of the document that was updated.
     */
    public UpdateResult(long existingTimestamp) {
        this.existingTimestamp = existingTimestamp;
    }

    public long getExistingTimestamp() { return existingTimestamp; }
}