Kinetic C/C++ Client
 All Classes Functions Variables Pages
kinetic_status.h
1 /*
2  * kinetic-cpp-client
3  * Copyright (C) 2014 Seagate Technology.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  */
20 
21 #ifndef KINETIC_CPP_CLIENT_KINETIC_STATUS_H_
22 #define KINETIC_CPP_CLIENT_KINETIC_STATUS_H_
23 
24 #include "kinetic/status_code.h"
25 
26 namespace kinetic {
27 
28 using std::string;
29 
34  public:
35  KineticStatus(const StatusCode code,
36  const string& message,
37  const int64_t expected_cluster_version = 0) :
38  code_(code),
39  message_(message),
40  expected_cluster_version_(expected_cluster_version) {}
41 
42  KineticStatus(const KineticStatus& status) :
43  code_(status.code_),
44  message_(status.message_),
45  expected_cluster_version_(status.expected_cluster_version_) {}
46 
47  bool ok() const {
48  return code_ == StatusCode::OK;
49  }
50 
51  StatusCode statusCode() const {
52  return code_;
53  }
54 
55  const string& message() const {
56  return message_;
57  }
58 
59  int64_t expected_cluster_version() const {
60  return expected_cluster_version_;
61  }
62 
63  void operator=(const KineticStatus& other) {
64  code_ = other.code_;
65  message_ = other.message_;
66  expected_cluster_version_ = other.expected_cluster_version_;
67  }
68 
69  private:
70  StatusCode code_;
71  string message_;
72  int64_t expected_cluster_version_;
73 };
74 
75 } // namespace kinetic
76 
77 #endif // KINETIC_CPP_CLIENT_KINETIC_STATUS_H_
Indicates whether a Kinetic operation (get, put, security, etc) put succeeded or failed. Unlike Status it provides details like whether the failure resulted from a version or an HMAC error.