42 CellStoreTrailerV3::CellStoreTrailerV3() {
43 assert(
sizeof(
float) == 4);
50 void CellStoreTrailerV3::clear() {
57 filter_items_estimate = 0;
58 filter_items_actual = 0;
66 table_id = 0xffffffff;
69 compression_ratio = 0.0;
71 key_compression_scheme = 0;
73 bloom_filter_hash_count = 0;
81 void CellStoreTrailerV3::serialize(uint8_t *buf) {
105 encode_i8(&buf, bloom_filter_hash_count);
107 assert(version == 3);
108 assert((buf-base) == (
int)CellStoreTrailerV3::size());
116 void CellStoreTrailerV3::deserialize(
const uint8_t *buf) {
117 HT_TRY(
"deserializing cellstore trailer",
118 size_t remaining = CellStoreTrailerV3::size();
119 fix_index_offset =
decode_i64(&buf, &remaining);
120 var_index_offset =
decode_i64(&buf, &remaining);
125 filter_items_estimate =
decode_i64(&buf, &remaining);
126 filter_items_actual =
decode_i64(&buf, &remaining);
131 expiration_time =
decode_i64(&buf, &remaining);
133 expirable_data =
decode_i64(&buf, &remaining);
135 table_generation =
decode_i32(&buf, &remaining);
137 compression_ratio_i32 =
decode_i32(&buf, &remaining);
138 compression_type =
decode_i16(&buf, &remaining);
139 key_compression_scheme =
decode_i16(&buf, &remaining);
140 bloom_filter_mode =
decode_i8(&buf, &remaining);
141 bloom_filter_hash_count =
decode_i8(&buf, &remaining);
149 void CellStoreTrailerV3::display(std::ostream &os) {
150 os <<
"{CellStoreTrailerV3: ";
151 os <<
"fix_index_offset=" << fix_index_offset;
152 os <<
", var_index_offset=" << var_index_offset;
153 os <<
", filter_offset=" << filter_offset;
154 os <<
", index_entries=" << index_entries;
155 os <<
", total_entries=" << total_entries;
156 os <<
", filter_length = " << filter_length;
157 os <<
", filter_items_estimate = " << filter_items_estimate;
158 os <<
", filter_items_actual = " << filter_items_actual;
159 os <<
", blocksize=" << blocksize;
160 os <<
", revision=" << revision;
161 os <<
", timestamp_min=" << timestamp_min;
162 os <<
", timestamp_max=" << timestamp_max;
163 os <<
", expiration_time=" << expiration_time;
164 os <<
", create_time=" << create_time;
165 os <<
", expirable_data=" << expirable_data;
166 os <<
", table_id=" << table_id;
167 os <<
", table_generation=" << table_generation;
168 if (flags & INDEX_64BIT)
169 os <<
", flags=64BIT_INDEX";
171 os <<
", flags=" << flags;
172 os <<
", compression_ratio=" << compression_ratio;
173 os <<
", compression_type=" << compression_type;
174 os <<
", key_compression_scheme=" << key_compression_scheme;
176 os <<
", bloom_filter_mode=DISABLED";
178 os <<
", bloom_filter_mode=ROWS";
180 os <<
", bloom_filter_mode=ROWS_COLS";
182 os <<
", bloom_filter_mode=?(" << bloom_filter_mode <<
")";
183 os <<
", bloom_filter_hash_count=" << bloom_filter_hash_count;
184 os <<
", version=" << version <<
"}";
189 void CellStoreTrailerV3::display_multiline(std::ostream &os) {
190 os <<
"[CellStoreTrailerV3]\n";
191 os <<
" fix_index_offset: " << fix_index_offset <<
"\n";
192 os <<
" var_index_offset: " << var_index_offset <<
"\n";
193 os <<
" filter_offset: " << filter_offset <<
"\n";
194 os <<
" index_entries: " << index_entries <<
"\n";
195 os <<
" total_entries: " << total_entries <<
"\n";
196 os <<
" filter_length: " << filter_length <<
"\n";
197 os <<
" filter_items_estimate: " << filter_items_estimate <<
"\n";
198 os <<
" filter_items_actual: " << filter_items_actual <<
"\n";
199 os <<
" blocksize: " << blocksize <<
"\n";
200 os <<
" revision: " << revision <<
"\n";
201 os <<
" timestamp_min: " << timestamp_min <<
"\n";
202 os <<
" timestamp_max: " << timestamp_max <<
"\n";
203 os <<
" expiration_time: " << expiration_time <<
"\n";
204 os <<
" create_time: " << create_time <<
"\n";
205 os <<
" expirable_data: " << expirable_data <<
"\n";
206 os <<
" table_id: " << table_id <<
"\n";
207 os <<
" table_generation: " << table_generation <<
"\n";
208 if (flags & INDEX_64BIT)
209 os <<
" flags: 64BIT_INDEX\n";
211 os <<
" flags=" << flags <<
"\n";
212 os <<
" compression_ratio: " << compression_ratio <<
"\n";
213 os <<
" compression_type: " << compression_type <<
"\n";
214 os <<
" key_compression_scheme: " << key_compression_scheme <<
"\n";
216 os <<
" bloom_filter_mode=DISABLED\n";
218 os <<
" bloom_filter_mode=ROWS\n";
220 os <<
" bloom_filter_mode=ROWS_COLS\n";
222 os <<
" bloom_filter_mode=?(" << bloom_filter_mode <<
")\n";
223 os <<
" bloom_filter_hash_count=" << (int)bloom_filter_hash_count <<
"\n";
224 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_NULL
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.