28#ifndef MYSQL_BUFFER_GROW_CONSTRAINT_H_
29#define MYSQL_BUFFER_GROW_CONSTRAINT_H_
131 ss <<
"Grow_constraint(ptr=" << (
const void *)
this
152 ret.set_max_size(std::min(
get_max_size(), other.get_max_size()));
153 ret.set_grow_factor(std::max(
get_grow_factor(), other.get_grow_factor()));
154 ret.set_grow_increment(
156 ret.set_block_size(std::max(
get_block_size(), other.get_block_size()));
Description of a heuristic to determine how much memory to allocate.
Definition: grow_constraint.h:67
Grow_constraint(const Grow_constraint &other)=default
Size_t get_max_size() const
Definition: grow_constraint.cpp:32
Grow_constraint()=default
static constexpr double default_grow_factor
By default, don't constrain the grow factor.
Definition: grow_constraint.h:165
static constexpr Size_t machine_max_size
Maximum allowed value for the application max size.
Definition: grow_constraint.h:73
Grow_constraint(Grow_constraint &&other)=default
virtual ~Grow_constraint()=default
void set_grow_increment(Size_t grow_increment)
Set the grow increment.
Definition: grow_constraint.cpp:43
void set_grow_factor(double grow_factor)
Set the grow factor.
Definition: grow_constraint.cpp:36
Size_t get_block_size() const
Definition: grow_constraint.cpp:56
double m_grow_factor
Definition: grow_constraint.h:174
Size_t get_grow_increment() const
Definition: grow_constraint.cpp:48
Size_t m_block_size
Definition: grow_constraint.h:180
std::size_t Size_t
Definition: grow_constraint.h:69
T combine_with(const T &other) const
Combine the constraints of this object with another Grow_constraint or Grow_calculator object.
Definition: grow_constraint.h:150
void set_max_size(Size_t max_size)
Set the maximum size.
Definition: grow_constraint.cpp:30
static constexpr Size_t default_grow_increment
By default, don't constrain the grow increment.
Definition: grow_constraint.h:168
Grow_constraint & operator=(Grow_constraint &&other)=default
double get_grow_factor() const
Definition: grow_constraint.cpp:41
static constexpr Size_t default_block_size
By default, don't constrain the block size.
Definition: grow_constraint.h:171
Size_t m_max_size
Size must not exceed this number.
Definition: grow_constraint.h:162
std::string debug_string() const
In debug mode, return a string that describes the internal structure of this object,...
Definition: grow_constraint.h:125
Grow_constraint & operator=(const Grow_constraint &other)=default
Size_t m_grow_increment
Definition: grow_constraint.h:177
void set_block_size(Size_t block_size)
Set the block size.
Definition: grow_constraint.cpp:52
std::pair< bool, Size_t > Result_t
Return type for compute_new_size.
Definition: grow_constraint.h:71
Definition: buffer_sequence_view.h:51
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2870
#define NODISCARD
The function attribute [[NODISCARD]] is a replacement for [[nodiscard]] to workaround a gcc bug.
Definition: nodiscard.h:47