42 CellStoreTrailerV2::CellStoreTrailerV2() {
43 assert(
sizeof(
float) == 4);
50 void CellStoreTrailerV2::clear() {
57 filter_items_estimate = 0;
58 filter_items_actual = 0;
64 table_id = 0xffffffff;
67 compression_ratio = 0.0;
70 bloom_filter_hash_count = 0;
78 void CellStoreTrailerV2::serialize(uint8_t *buf) {
101 assert(version == 2);
102 assert((buf-base) == (
int)CellStoreTrailerV2::size());
110 void CellStoreTrailerV2::deserialize(
const uint8_t *buf) {
111 HT_TRY(
"deserializing cellstore trailer",
112 size_t remaining = CellStoreTrailerV2::size();
113 fix_index_offset =
decode_i64(&buf, &remaining);
114 var_index_offset =
decode_i64(&buf, &remaining);
119 filter_items_estimate =
decode_i64(&buf, &remaining);
120 filter_items_actual =
decode_i64(&buf, &remaining);
127 table_generation =
decode_i32(&buf, &remaining);
129 compression_ratio_i32 =
decode_i32(&buf, &remaining);
130 compression_type =
decode_i16(&buf, &remaining);
131 bloom_filter_mode =
decode_i8(&buf, &remaining);
132 bloom_filter_hash_count =
decode_i8(&buf, &remaining);
140 void CellStoreTrailerV2::display(std::ostream &os) {
141 os <<
"{CellStoreTrailerV2: ";
142 os <<
"fix_index_offset=" << fix_index_offset;
143 os <<
", var_index_offset=" << var_index_offset;
144 os <<
", filter_offset=" << filter_offset;
145 os <<
", index_entries=" << index_entries;
146 os <<
", total_entries=" << total_entries;
147 os <<
", filter_length = " << filter_length;
148 os <<
", filter_items_estimate = " << filter_items_estimate;
149 os <<
", filter_items_actual = " << filter_items_actual;
150 os <<
", blocksize=" << blocksize;
151 os <<
", revision=" << revision;
152 os <<
", timestamp_min=" << timestamp_min;
153 os <<
", timestamp_max=" << timestamp_max;
154 os <<
", create_time=" << create_time;
155 os <<
", table_id=" << table_id;
156 os <<
", table_generation=" << table_generation;
157 if (flags & INDEX_64BIT)
158 os <<
", flags=64BIT_INDEX";
160 os <<
", flags=" << flags;
161 os <<
", compression_ratio=" << compression_ratio;
162 os <<
", compression_type=" << compression_type;
164 os <<
", bloom_filter_mode=DISABLED";
166 os <<
", bloom_filter_mode=ROWS";
168 os <<
", bloom_filter_mode=ROWS_COLS";
170 os <<
", bloom_filter_mode=?(" << bloom_filter_mode <<
")";
171 os <<
", bloom_filter_hash_count=" << bloom_filter_hash_count;
172 os <<
", version=" << version <<
"}";
177 void CellStoreTrailerV2::display_multiline(std::ostream &os) {
178 os <<
"[CellStoreTrailerV2]\n";
179 os <<
" fix_index_offset: " << fix_index_offset <<
"\n";
180 os <<
" var_index_offset: " << var_index_offset <<
"\n";
181 os <<
" filter_offset: " << filter_offset <<
"\n";
182 os <<
" index_entries: " << index_entries <<
"\n";
183 os <<
" total_entries: " << total_entries <<
"\n";
184 os <<
" filter_length: " << filter_length <<
"\n";
185 os <<
" filter_items_estimate: " << filter_items_estimate <<
"\n";
186 os <<
" filter_items_actual: " << filter_items_actual <<
"\n";
187 os <<
" blocksize: " << blocksize <<
"\n";
188 os <<
" revision: " << revision <<
"\n";
189 os <<
" timestamp_min: " << timestamp_min <<
"\n";
190 os <<
" timestamp_max: " << timestamp_max <<
"\n";
191 os <<
" create_time: " << create_time <<
"\n";
192 os <<
" table_id: " << table_id <<
"\n";
193 os <<
" table_generation: " << table_generation <<
"\n";
194 if (flags & INDEX_64BIT)
195 os <<
" flags: 64BIT_INDEX\n";
197 os <<
" flags=" << flags <<
"\n";
198 os <<
" compression_ratio: " << compression_ratio <<
"\n";
199 os <<
" compression_type: " << compression_type <<
"\n";
201 os <<
" bloom_filter_mode=DISABLED\n";
203 os <<
" bloom_filter_mode=ROWS\n";
205 os <<
" bloom_filter_mode=ROWS_COLS\n";
207 os <<
" bloom_filter_mode=?(" << bloom_filter_mode <<
")\n";
208 os <<
" bloom_filter_hash_count=" << (int)bloom_filter_hash_count <<
"\n";
209 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
uint8_t decode_i8(const uint8_t **bufp, size_t *remainp)
Decode a 8-bit integer (a byte/character)
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_)
void encode_i8(uint8_t **bufp, uint8_t val)
Encodes a byte into the given buffer.