aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storageapi/messageapi/storagereply.h
blob: 8fa760ee7b2b280f5214268a9e84dbf2baa1d085 (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * @class storage::api::StorageReply
 * @ingroup messageapi
 *
 * @brief Superclass for all storage replies.
 *
 * A storage reply is a storage message sent in reply to a storage command.
 *
 * @version $Id$
 */

#pragma once

#include "returncode.h"
#include "storagemessage.h"

namespace storage::api {

class StorageCommand;

class StorageReply : public StorageMessage {
    ReturnCode _result;

protected:
    explicit StorageReply(const StorageCommand& cmd);
    StorageReply(const StorageCommand& cmd, ReturnCode code);

public:
    ~StorageReply() override;
    DECLARE_POINTER_TYPEDEFS(StorageReply);

    void setResult(ReturnCode r) { _result = std::move(r); }
    void setResult(ReturnCode::Result r) { _result = ReturnCode(r); }
    const ReturnCode& getResult() const { return _result; }
    void print(std::ostream& out, bool verbose, const std::string& indent) const override;
};

}