41 CellStoreTrailerV1::CellStoreTrailerV1() {
42 assert(
sizeof(
float) == 4);
49 void CellStoreTrailerV1::clear() {
56 filter_false_positive_prob = 0.0;
62 table_id = 0xffffffff;
65 compression_ratio = 0.0;
74 void CellStoreTrailerV1::serialize(uint8_t *buf) {
82 encode_i32(&buf, filter_false_positive_prob_i32);
95 assert((buf-base) == (
int)CellStoreTrailerV1::size());
103 void CellStoreTrailerV1::deserialize(
const uint8_t *buf) {
104 HT_TRY(
"deserializing cellstore trailer",
105 size_t remaining = CellStoreTrailerV1::size();
106 fix_index_offset =
decode_i64(&buf, &remaining);
107 var_index_offset =
decode_i64(&buf, &remaining);
111 num_filter_items =
decode_i64(&buf, &remaining);
112 filter_false_positive_prob_i32 =
decode_i32(&buf, &remaining);
119 table_generation =
decode_i32(&buf, &remaining);
121 compression_ratio_i32 =
decode_i32(&buf, &remaining);
122 compression_type =
decode_i16(&buf, &remaining);
130 void CellStoreTrailerV1::display(std::ostream &os) {
131 os <<
"{CellStoreTrailerV1: ";
132 os <<
"fix_index_offset=" << fix_index_offset;
133 os <<
", var_index_offset=" << var_index_offset;
134 os <<
", filter_offset=" << filter_offset;
135 os <<
", index_entries=" << index_entries;
136 os <<
", total_entries=" << total_entries;
137 os <<
", num_filter_items = " << num_filter_items;
138 os <<
", filter_false_positive_prob = "
139 << filter_false_positive_prob;
140 os <<
", blocksize=" << blocksize;
141 os <<
", revision=" << revision;
142 os <<
", timestamp_min=" << timestamp_min;
143 os <<
", timestamp_max=" << timestamp_max;
144 os <<
", create_time=" << create_time;
145 os <<
", table_id=" << table_id;
146 os <<
", table_generation=" << table_generation;
147 if (flags & INDEX_64BIT)
148 os <<
", flags=64BIT_INDEX";
150 os <<
", flags=" << flags;
151 os <<
", compression_ratio=" << compression_ratio;
152 os <<
", compression_type=" << compression_type;
153 os <<
", version=" << version <<
"}";
158 void CellStoreTrailerV1::display_multiline(std::ostream &os) {
159 os <<
"[CellStoreTrailerV1]\n";
160 os <<
" fix_index_offset: " << fix_index_offset <<
"\n";
161 os <<
" var_index_offset: " << var_index_offset <<
"\n";
162 os <<
" filter_offset: " << filter_offset <<
"\n";
163 os <<
" index_entries: " << index_entries <<
"\n";
164 os <<
" total_entries: " << total_entries <<
"\n";
165 os <<
" num_filter_items: " << num_filter_items <<
"\n";
166 os <<
" filter_false_positive_prob: "
167 << filter_false_positive_prob <<
"\n";
168 os <<
" blocksize: " << blocksize <<
"\n";
169 os <<
" revision: " << revision <<
"\n";
170 os <<
" timestamp_min: " << timestamp_min <<
"\n";
171 os <<
" timestamp_max: " << timestamp_max <<
"\n";
172 os <<
" create_time: " << create_time <<
"\n";
173 os <<
" table_id: " << table_id <<
"\n";
174 os <<
" table_generation: " << table_generation <<
"\n";
175 if (flags & INDEX_64BIT)
176 os <<
" flags: 64BIT_INDEX\n";
178 os <<
" flags=" << flags <<
"\n";
179 os <<
" compression_ratio: " << compression_ratio <<
"\n";
180 os <<
" compression_type: " << compression_type <<
"\n";
181 os <<
" version: " << version << std::endl;
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
static const int64_t TIMESTAMP_MIN
uint64_t decode_i64(const uint8_t **bufp, size_t *remainp)
Decode a 64-bit integer in little-endian order.
uint16_t decode_i16(const uint8_t **bufp, size_t *remainp)
Decode a 16-bit integer in little-endian order.
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++.
void encode_i16(uint8_t **bufp, uint16_t val)
Encode a 16-bit integer in little-endian order.
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_MAX
#define HT_TRY(_s_, _code_)