Skip to content

Commit

Permalink
bytes: publicly expose the inline buffer size of bytes
Browse files Browse the repository at this point in the history
This enables other code to accurately account for memory use.
  • Loading branch information
jcsp committed Aug 5, 2022
1 parent 53fcd5d commit c1b1e9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/v/bytes/bytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
#include <iosfwd>

// cannot be a `std::byte` because that's not sizeof(char)
constexpr size_t bytes_inline_size = 31;
using bytes = ss::basic_sstring<
uint8_t, // Must be different from char to not leak to std::string_view
uint32_t, // size type - 4 bytes - 4GB max - don't use a size_t or any 64-bit
31, // NOLINT(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
// short string optimization size
false // not null terminated
bytes_inline_size, // short string optimization size
false // not null terminated
>;

using bytes_view = std::basic_string_view<uint8_t>;
Expand Down

0 comments on commit c1b1e9c

Please sign in to comment.