summaryrefslogtreecommitdiffstats
path: root/persistence/src/main/java/com/yahoo/persistence/spi/result/RemoveResult.java
blob: c712da41286b58c7125f8ca8720c86a77c94e5b7 (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
// 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 Remove operations
 */
public class RemoveResult extends Result {
    boolean wasFound = false;

    /**
     * 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 RemoveResult(Result.ErrorType error, String message) {
        super(error, message);
    }

    /**
     * Constructor to use when there was no document to remove.
     */
    public RemoveResult() {}

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

    @Override
    public boolean equals(Object other) {
        if (other instanceof RemoveResult) {
            return super.equals((Result)other) &&
                   wasFound == ((RemoveResult)other).wasFound;
        }

        return false;
    }

    public boolean wasFound() { return wasFound; }
}