MySQL 8.0.40
Source Code Documentation
|
The variant with length (ImmutableStringWithLength) stores the length as a Varint128 (similar to protobuf), immediately followed by the string itself. More...
#include <immutable_string.h>
Public Member Functions | |
ImmutableStringWithLength ()=default | |
ImmutableStringWithLength (const char *encoded) | |
std::string_view | Decode () const |
bool | operator== (ImmutableStringWithLength other) const |
Compares full contents (data/size). More... | |
Static Public Member Functions | |
static ImmutableStringWithLength | Encode (const char *data, size_t length, char **dst) |
Encode the given string as an ImmutableStringWithLength, and returns a new object pointing to it. More... | |
static size_t | RequiredBytesForEncode (size_t length) |
Calculates an upper bound on the space required for encoding a string of the given length. More... | |
Private Attributes | |
const char * | m_ptr = nullptr |
The variant with length (ImmutableStringWithLength) stores the length as a Varint128 (similar to protobuf), immediately followed by the string itself.
(There is no zero termination.) This saves space over using e.g. a fixed size_t as length, since most strings are short. This is used for keys in the hash join buffer, but would be applicable other places as well.
|
default |
|
inlineexplicit |
|
inline |
|
inlinestatic |
Encode the given string as an ImmutableStringWithLength, and returns a new object pointing to it.
*dst must contain at least the number of bytes returned by RequiredBytesForEncode.
“dst” is moved to one byte past the end of the written stream.
|
inline |
Compares full contents (data/size).
|
inlinestatic |
Calculates an upper bound on the space required for encoding a string of the given length.
|
private |