]>
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 both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
10 #include "rocksdb/rocksdb_namespace.h"
16 namespace ROCKSDB_NAMESPACE
{
18 class LDBCommandExecuteResult
{
26 LDBCommandExecuteResult() : state_(EXEC_NOT_STARTED
), message_("") {}
28 LDBCommandExecuteResult(State state
, std::string
& msg
)
29 : state_(state
), message_(msg
) {}
31 std::string
ToString() {
37 ret
.append("Failed: ");
39 case EXEC_NOT_STARTED
:
40 ret
.append("Not started: ");
42 if (!message_
.empty()) {
49 state_
= EXEC_NOT_STARTED
;
53 bool IsSucceed() { return state_
== EXEC_SUCCEED
; }
55 bool IsNotStarted() { return state_
== EXEC_NOT_STARTED
; }
57 bool IsFailed() { 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
&);
75 } // namespace ROCKSDB_NAMESPACE