#include <stdint.h>
#include <string>
#include "kudu/client/stubs.h"
#include "kudu/util/kudu_export.h"
#include "kudu/util/slice.h"
Go to the source code of this file.
Classes | |
class | kudu::Status |
A representation of an operation's outcome. More... | |
Defines | |
#define | KUDU_RETURN_NOT_OK(s) |
Return the given status if it is not OK . | |
#define | KUDU_RETURN_NOT_OK_PREPEND(s, msg) |
Return the given status if it is not OK, but first clone it and prepend the given message. | |
#define | KUDU_RETURN_NOT_OK_RET(to_call, to_return) |
Return to_return if to_call returns a bad status. The substitution for 'to_return' may reference the variable s for the bad status. | |
#define | KUDU_WARN_NOT_OK(to_call, warning_prefix) |
Emit a warning if to_call returns a bad status. | |
#define | KUDU_LOG_AND_RETURN(level, status) |
Log the given status and return immediately. | |
#define | KUDU_CHECK_OK_PREPEND(to_call, msg) |
If to_call returns a bad status, CHECK immediately with a logged message of msg followed by the status. | |
#define | KUDU_CHECK_OK(s) KUDU_CHECK_OK_PREPEND(s, "Bad status") |
If the status is bad, CHECK immediately, appending the status to the logged message. |
This header is used in both the Kudu build as well as in builds of applications that use the Kudu C++ client. In the latter we need to be careful to "namespace" our macros, to avoid colliding or overriding with similarly named macros belonging to the application.
KUDU_HEADERS_USE_SHORT_STATUS_MACROS handles this behavioral change. When defined, we're building Kudu and:
#define KUDU_CHECK_OK_PREPEND | ( | to_call, | |||
msg | ) |
do { \ const ::kudu::Status& _s = (to_call); \ KUDU_CHECK(_s.ok()) << (msg) << ": " << _s.ToString(); \ } while (0);
If to_call
returns a bad status, CHECK immediately with a logged message of msg
followed by the status.
#define KUDU_LOG_AND_RETURN | ( | level, | |||
status | ) |
do { \ const ::kudu::Status& _s = (status); \ KUDU_LOG(level) << _s.ToString(); \ return _s; \ } while (0);
Log the given status and return immediately.
#define KUDU_RETURN_NOT_OK | ( | s | ) |
do { \ const ::kudu::Status& _s = (s); \ if (PREDICT_FALSE(!_s.ok())) return _s; \ } while (0);
Return the given status if it is not OK
.
#define KUDU_RETURN_NOT_OK_PREPEND | ( | s, | |||
msg | ) |
do { \ const ::kudu::Status& _s = (s); \ if (PREDICT_FALSE(!_s.ok())) return _s.CloneAndPrepend(msg); \ } while (0);
Return the given status if it is not OK, but first clone it and prepend the given message.
#define KUDU_RETURN_NOT_OK_RET | ( | to_call, | |||
to_return | ) |
do { \ const ::kudu::Status& s = (to_call); \ if (PREDICT_FALSE(!s.ok())) return (to_return); \ } while (0);
Return to_return
if to_call
returns a bad status. The substitution for 'to_return' may reference the variable s
for the bad status.
#define KUDU_WARN_NOT_OK | ( | to_call, | |||
warning_prefix | ) |
do { \ const ::kudu::Status& _s = (to_call); \ if (PREDICT_FALSE(!_s.ok())) { \ KUDU_LOG(WARNING) << (warning_prefix) << ": " << _s.ToString(); \ } \ } while (0);
Emit a warning if to_call
returns a bad status.