]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/utilities/ldb_cmd_execute_result.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
14 class LDBCommandExecuteResult
{
17 EXEC_NOT_STARTED
= 0, EXEC_SUCCEED
= 1, EXEC_FAILED
= 2,
20 LDBCommandExecuteResult() : state_(EXEC_NOT_STARTED
), message_("") {}
22 LDBCommandExecuteResult(State state
, std::string
& msg
) :
23 state_(state
), message_(msg
) {}
25 std::string
ToString() {
31 ret
.append("Failed: ");
33 case EXEC_NOT_STARTED
:
34 ret
.append("Not started: ");
36 if (!message_
.empty()) {
43 state_
= EXEC_NOT_STARTED
;
48 return state_
== EXEC_SUCCEED
;
52 return state_
== EXEC_NOT_STARTED
;
56 return state_
== EXEC_FAILED
;
59 static LDBCommandExecuteResult
Succeed(std::string msg
) {
60 return LDBCommandExecuteResult(EXEC_SUCCEED
, msg
);
63 static LDBCommandExecuteResult
Failed(std::string msg
) {
64 return LDBCommandExecuteResult(EXEC_FAILED
, msg
);
71 bool operator==(const LDBCommandExecuteResult
&);
72 bool operator!=(const LDBCommandExecuteResult
&);