Apply clang format

This commit is contained in:
Junhyun Shim 2022-04-13 10:56:02 +02:00
parent 1de56eabf0
commit 0256c08cab
3 changed files with 16 additions and 22 deletions

View File

@ -91,7 +91,7 @@ void ResumableStateForRunWorkload::runOneTick() {
}
auto f = Future{};
// to minimize context switch overhead, repeat immediately completed ops
// in a loop, not async continuation.
// in a loop, not an async continuation.
repeat_immediate_steps:
f = opTable[iter.op].stepFunction(iter.step)(tx, args, key1, key2, val);
if (!f) {
@ -108,11 +108,11 @@ repeat_immediate_steps:
if (iter.stepKind() != StepKind::ON_ERROR) {
if (auto err = f.error()) {
logr.printWithLogLevel(err.retryable() ? VERBOSE_WARN : VERBOSE_NONE,
"ERROR",
"{}:{} returned '{}'",
iter.opName(),
iter.step,
err.what());
"ERROR",
"{}:{} returned '{}'",
iter.opName(),
iter.step,
err.what());
tx.onError(err).then([this, state = shared_from_this()](Future f) {
const auto rc = handleForOnError(tx, f, fmt::format("{}:{}", iter.opName(), iter.step));
if (rc == FutureRC::RETRY) {
@ -204,9 +204,9 @@ void ResumableStateForRunWorkload::onTaskSuccess() {
if (auto err = f.error()) {
// commit had errors
logr.printWithLogLevel(err.retryable() ? VERBOSE_WARN : VERBOSE_NONE,
"ERROR",
"Post-iteration commit returned error: {}",
err.what());
"ERROR",
"Post-iteration commit returned error: {}",
err.what());
tx.onError(err).then([this, state = shared_from_this()](Future f) {
const auto rc = handleForOnError(tx, f, "ON_ERROR");
if (rc == FutureRC::CONFLICT)

View File

@ -14,7 +14,7 @@ OpIterator getOpBegin(Arguments const& args) noexcept {
for (auto op = 0; op < MAX_OP; op++) {
if (isAbstractOp(op) || args.txnspec.ops[op][OP_COUNT] == 0)
continue;
return OpIterator{op, 0, 0};
return OpIterator{ op, 0, 0 };
}
return OpEnd;
}
@ -25,12 +25,12 @@ OpIterator getOpNext(Arguments const& args, OpIterator current) noexcept {
auto [op, count, step] = current;
assert(op < MAX_OP && !isAbstractOp(op));
if (opTable[op].steps() > step + 1)
return OpIterator{op, count, step + 1};
return OpIterator{ op, count, step + 1 };
count++;
for (; op < MAX_OP; op++, count = 0) {
if (isAbstractOp(op) || args.txnspec.ops[op][OP_COUNT] <= count)
continue;
return OpIterator{op, count, 0};
return OpIterator{ op, count, 0 };
}
return OpEnd;
}

View File

@ -95,20 +95,14 @@ struct OpIterator {
return op == other.op && count == other.count && step == other.step;
}
bool operator!=(const OpIterator& other) const noexcept {
return !(*this == other);
}
bool operator!=(const OpIterator& other) const noexcept { return !(*this == other); }
StepKind stepKind() const noexcept {
return opTable[op].stepKind(step);
}
StepKind stepKind() const noexcept { return opTable[op].stepKind(step); }
char const* opName() const noexcept {
return getOpName(op);
}
char const* opName() const noexcept { return getOpName(op); }
};
constexpr const OpIterator OpEnd = OpIterator{MAX_OP, -1, -1};
constexpr const OpIterator OpEnd = OpIterator{ MAX_OP, -1, -1 };
OpIterator getOpBegin(Arguments const& args) noexcept;