mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-26 11:30:36 +00:00
transport/server: read_string_view() helper
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
@@ -825,6 +825,17 @@ sstring cql_server::connection::read_string(temporary_buffer<char>& buf)
|
||||
return s;
|
||||
}
|
||||
|
||||
sstring_view cql_server::connection::read_string_view(temporary_buffer<char>& buf)
|
||||
{
|
||||
auto n = read_short(buf);
|
||||
check_room(buf, n);
|
||||
sstring_view s{buf.begin(), static_cast<size_t>(n)};
|
||||
assert(n >= 0);
|
||||
buf.trim_front(n);
|
||||
validate_utf8(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
sstring_view cql_server::connection::read_long_string_view(temporary_buffer<char>& buf)
|
||||
{
|
||||
auto n = read_int(buf);
|
||||
|
||||
@@ -177,10 +177,11 @@ private:
|
||||
int16_t read_short(temporary_buffer<char>& buf);
|
||||
uint16_t read_unsigned_short(temporary_buffer<char>& buf);
|
||||
sstring read_string(temporary_buffer<char>& buf);
|
||||
sstring_view read_string_view(temporary_buffer<char>& buf);
|
||||
sstring_view read_long_string_view(temporary_buffer<char>& buf);
|
||||
bytes read_short_bytes(temporary_buffer<char>& buf);
|
||||
bytes_opt read_value(temporary_buffer<char>& buf);
|
||||
bytes_view_opt read_value_view(temporary_buffer<char>& buf);
|
||||
sstring_view read_long_string_view(temporary_buffer<char>& buf);
|
||||
void read_name_and_value_list(temporary_buffer<char>& buf, std::vector<sstring>& names, std::vector<bytes_view_opt>& values);
|
||||
void read_string_list(temporary_buffer<char>& buf, std::vector<sstring>& strings);
|
||||
void read_value_view_list(temporary_buffer<char>& buf, std::vector<bytes_view_opt>& values);
|
||||
|
||||
Reference in New Issue
Block a user