33 const char *column_qualifier, int64_t timestamp,
34 const void *value, int32_t value_length,
36 int32_t row_length = strlen(row);
37 int32_t column_family_length = column_family ? strlen(column_family) : 0;
38 int32_t column_qualifier_length = column_qualifier ? strlen(column_qualifier) : 0;
43 "Attempt to add empty row key to serialized cells buffer");
45 bool need_row =
false;
50 if (!value && value_length)
53 int32_t length = 9 + column_family_length + 3
54 + column_qualifier_length + value_length + 1;
105 memcpy(
m_buf.
ptr, column_family, column_family_length);
110 if (column_qualifier)
111 memcpy(
m_buf.
ptr, column_qualifier, column_qualifier_length);
112 m_buf.
ptr += column_qualifier_length;
117 memcpy(
m_buf.
ptr, value, value_length);
bool empty() const
Returns true if the buffer is empty.
uint8_t * ptr
Pointer to the end of the used part of the buffer.
void grow(size_t new_size, bool nocopy=false)
Grows the buffer and copies the data unless nocopy is true.
Logging routines and macros.
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
Compatibility Macros for C/C++.
int m_previous_row_offset
void encode_i64(uint8_t **bufp, uint64_t val)
Encode a 64-bit integer in little-endian order.
Functions to serialize/deserialize primitives to/from a memory buffer.
static const int64_t TIMESTAMP_NULL
void clear()
Clears the buffer.
int32_t m_previous_row_length
uint8_t * base
Pointer to the allocated memory buffer.
static const int64_t AUTO_ASSIGN
Error codes, Exception handling, error logging.
#define HT_THROW(_code_, _msg_)
void ensure(size_t len)
Ensure space for additional data Will grow the space to 1.5 of the needed space with existing data un...
size_t remaining() const
Returns the size of the unused portion.
void encode_i8(uint8_t **bufp, uint8_t val)
Encodes a byte into the given buffer.