@@ -30,7 +30,7 @@ namespace storage {
30
30
31
31
const char *MAGIC_STRING_TSFILE = " TsFile" ;
32
32
const int MAGIC_STRING_TSFILE_LEN = 6 ;
33
- const char VERSION_NUM_BYTE = 0x04 ;// 0x03;
33
+ const char VERSION_NUM_BYTE = 0x04 ; // 0x03;
34
34
const char CHUNK_GROUP_HEADER_MARKER = 0 ;
35
35
const char CHUNK_HEADER_MARKER = 1 ;
36
36
const char ONLY_ONE_PAGE_CHUNK_HEADER_MARKER = 5 ;
@@ -104,13 +104,14 @@ int TSMIterator::init() {
104
104
chunk_meta_iter_++;
105
105
}
106
106
if (!tmp.empty ()) {
107
- tsm_chunk_meta_info_[chunk_group_meta_iter_.get ()
108
- -> device_id_ ] = tmp;
107
+ tsm_chunk_meta_info_[chunk_group_meta_iter_.get ()-> device_id_ ] =
108
+ tmp;
109
109
}
110
110
111
111
chunk_group_meta_iter_++;
112
112
}
113
- if (!tsm_chunk_meta_info_.empty () && !tsm_chunk_meta_info_.begin ()->second .empty ()) {
113
+ if (!tsm_chunk_meta_info_.empty () &&
114
+ !tsm_chunk_meta_info_.begin ()->second .empty ()) {
114
115
tsm_measurement_iter_ = tsm_chunk_meta_info_.begin ()->second .begin ();
115
116
}
116
117
tsm_device_iter_ = tsm_chunk_meta_info_.begin ();
@@ -121,7 +122,8 @@ bool TSMIterator::has_next() const {
121
122
return tsm_device_iter_ != tsm_chunk_meta_info_.end ();
122
123
}
123
124
124
- int TSMIterator::get_next (std::shared_ptr<IDeviceID> &ret_device_id, String &ret_measurement_name,
125
+ int TSMIterator::get_next (std::shared_ptr<IDeviceID> &ret_device_id,
126
+ String &ret_measurement_name,
125
127
TimeseriesIndex &ret_ts_index) {
126
128
int ret = E_OK;
127
129
SimpleList<ChunkMeta *> chunk_meta_list_of_this_ts (
@@ -153,7 +155,6 @@ int TSMIterator::get_next(std::shared_ptr<IDeviceID> &ret_device_id, String &ret
153
155
ret_ts_index.set_data_type (data_type);
154
156
ret_ts_index.init_statistic (data_type);
155
157
156
-
157
158
SimpleList<ChunkMeta *>::Iterator ts_chunk_meta_iter =
158
159
chunk_meta_list_of_this_ts.begin ();
159
160
for (;
@@ -199,9 +200,10 @@ int TsFileMeta::serialize_to(common::ByteStream &out) {
199
200
}
200
201
201
202
common::SerializationUtil::write_var_int (tsfile_properties_.size (), out);
202
- for (const auto & tsfile_property : tsfile_properties_) {
203
+ for (const auto & tsfile_property : tsfile_properties_) {
203
204
common::SerializationUtil::write_var_str (tsfile_property.first , out);
204
- common::SerializationUtil::write_var_str (tsfile_property.second , out);
205
+ common::SerializationUtil::write_var_char_ptr (tsfile_property.second ,
206
+ out);
205
207
}
206
208
207
209
return out.total_size () - start_idx;
@@ -250,24 +252,26 @@ int TsFileMeta::deserialize_from(common::ByteStream &in) {
250
252
int32_t tsfile_properties_size = 0 ;
251
253
common::SerializationUtil::read_var_int (tsfile_properties_size, in);
252
254
for (int i = 0 ; i < tsfile_properties_size; i++) {
253
- std::string key, value;
255
+ std::string key, * value;
254
256
common::SerializationUtil::read_var_str (key, in);
255
- common::SerializationUtil::read_var_str (value, in);
256
- tsfile_properties_.emplace (key, std::move ( value) );
257
+ common::SerializationUtil::read_var_char_ptr (value, in);
258
+ tsfile_properties_.emplace (key, value);
257
259
}
258
260
return ret;
259
261
}
260
262
261
263
/* ================ MetaIndexNode ================ */
262
- int MetaIndexNode::binary_search_children (std::shared_ptr<IComparable> key, bool exact_search,
263
- std::shared_ptr<IMetaIndexEntry> &ret_index_entry,
264
- int64_t &ret_end_offset) {
264
+ int MetaIndexNode::binary_search_children (
265
+ std::shared_ptr<IComparable> key, bool exact_search,
266
+ std::shared_ptr<IMetaIndexEntry> &ret_index_entry,
267
+ int64_t &ret_end_offset) {
265
268
#if DEBUG_SE
266
269
std::cout << " MetaIndexNode::binary_search_children start, name=" << key
267
270
<< " , exact_search=" << exact_search
268
271
<< " , children_.size=" << children_.size () << std::endl;
269
272
for (int i = 0 ; i < (int )children_.size (); i++) {
270
- std::cout << " Iterating children: " << children_[i]->get_name () << std::endl;
273
+ std::cout << " Iterating children: " << children_[i]->get_name ()
274
+ << std::endl;
271
275
}
272
276
#endif
273
277
bool is_aligned = false ;
@@ -298,7 +302,7 @@ int MetaIndexNode::binary_search_children(std::shared_ptr<IComparable> key, bool
298
302
break ;
299
303
} else if (cmp > 0 ) { // children_[m] > name
300
304
h = m;
301
- } else { // children_[m] < name
305
+ } else { // children_[m] < name
302
306
l = m;
303
307
}
304
308
}
0 commit comments