47 bool _alloc_failure =
false;
49 void free_buffer() noexcept;
50 void realloc_buffer_and_append(
char c) noexcept;
61 class inserter_iterator {
63 using iterator_category = std::output_iterator_tag;
64 using difference_type = std::ptrdiff_t;
65 using value_type = void;
67 using reference = void;
73 explicit inserter_iterator(log_buf& buf) noexcept : _buf(&buf) { }
75 inserter_iterator& operator=(
char c)
noexcept {
76 if (__builtin_expect(_buf->_current == _buf->_end,
false)) {
77 _buf->realloc_buffer_and_append(c);
80 *_buf->_current++ = c;
83 inserter_iterator& operator*() noexcept {
86 inserter_iterator& operator++() noexcept {
89 inserter_iterator operator++(
int)
noexcept {
102 log_buf(
char* external_buf,
size_t size)
noexcept;
107 void clear() { _current = _begin; }
109 inserter_iterator back_insert_begin() noexcept {
return inserter_iterator(*
this); }
111 size_t size() const noexcept {
return _current - _begin; }
113 size_t capacity() const noexcept {
return _end - _begin; }
117 const char* data() const noexcept {
return _begin; }
119 std::string_view view() const noexcept {
return std::string_view(_begin, size()); }
Seastar API namespace.
Definition: abort_on_ebadf.hh:26