Files
scylladb/cql3/description.cc
Kefu Chai 6ead5a4696 treewide: move log.hh into utils/log.hh
the log.hh under the root of the tree was created keep the backward
compatibility when seastar was extracted into a separate library.
so log.hh should belong to `utils` directory, as it is based solely
on seastar, and can be used all subsystems.

in this change, we move log.hh into utils/log.hh to that it is more
modularized. and this also improves the readability, when one see
`#include "utils/log.hh"`, it is obvious that this source file
needs the logging system, instead of its own log facility -- please
note, we do have two other `log.hh` in the tree.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-10-22 06:54:46 +03:00

44 lines
1.0 KiB
C++

/*
* Copyright (C) 2024-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "cql3/description.hh"
#include <seastar/core/on_internal_error.hh>
#include "cql3/util.hh"
#include "utils/log.hh"
#include "types/types.hh"
static logging::logger dlogger{"description"};
namespace cql3 {
std::vector<bytes_opt> description::serialize(bool serialize_create_statement) const {
std::vector<bytes_opt> result{};
result.reserve(serialize_create_statement ? 4 : 3);
if (keyspace) {
result.push_back(to_bytes(cql3::util::maybe_quote(*keyspace)));
} else {
result.push_back(data_value::make_null(utf8_type).serialize());
}
result.push_back(to_bytes(type));
result.push_back(to_bytes(cql3::util::maybe_quote(name)));
if (serialize_create_statement && create_statement) {
result.push_back(to_bytes(*create_statement));
} else if (serialize_create_statement) {
on_internal_error(dlogger, "create_statement field is empty");
}
return result;
}
} // namespace cql3