mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-30 19:46:48 +00:00
cql3: add a timeout column to LIST SERVICE LEVEL statement
Listing service levels now includes the timeout parameter.
This commit is contained in:
@@ -58,7 +58,9 @@ list_service_level_statement::execute(query_processor& qp,
|
||||
type);
|
||||
};
|
||||
|
||||
static thread_local const std::vector<lw_shared_ptr<column_specification>> metadata({make_column("service_level", utf8_type)});
|
||||
static thread_local const std::vector<lw_shared_ptr<column_specification>> metadata({make_column("service_level", utf8_type),
|
||||
make_column("timeout", duration_type),
|
||||
});
|
||||
|
||||
return make_ready_future().then([this, &state] () {
|
||||
if (_describe_all) {
|
||||
@@ -68,10 +70,24 @@ list_service_level_statement::execute(query_processor& qp,
|
||||
}
|
||||
})
|
||||
.then([this] (qos::service_levels_info sl_info) {
|
||||
auto d = [] (const qos::service_level_options::timeout_type& duration) -> bytes_opt {
|
||||
return std::visit(overloaded_functor{
|
||||
[&] (const qos::service_level_options::unset_marker&) {
|
||||
return bytes_opt();
|
||||
},
|
||||
[&] (const qos::service_level_options::delete_marker&) {
|
||||
return bytes_opt();
|
||||
},
|
||||
[&] (const lowres_clock::duration& d) -> bytes_opt {
|
||||
auto nanos = std::chrono::duration_cast<std::chrono::nanoseconds>(d).count();
|
||||
return duration_type->decompose(cql_duration(months_counter{0}, days_counter{0}, nanoseconds_counter{nanos}));
|
||||
},
|
||||
}, duration);
|
||||
};
|
||||
auto rs = std::make_unique<result_set>(metadata);
|
||||
for (auto &&sl : sl_info) {
|
||||
for (auto &&[sl_name, slo] : sl_info) {
|
||||
rs->add_row(std::vector<bytes_opt>{
|
||||
utf8_type->decompose(sl.first)});
|
||||
utf8_type->decompose(sl_name), d(slo.timeout)});
|
||||
}
|
||||
|
||||
auto rows = ::make_shared<cql_transport::messages::result_message::rows>(result(std::move(std::move(rs))));
|
||||
|
||||
Reference in New Issue
Block a user