@@ -30,7 +30,7 @@ namespace storage {
3030
3131const char *MAGIC_STRING_TSFILE = " TsFile" ;
3232const int MAGIC_STRING_TSFILE_LEN = 6 ;
33- const char VERSION_NUM_BYTE = 0x04 ;// 0x03;
33+ const char VERSION_NUM_BYTE = 0x04 ; // 0x03;
3434const char CHUNK_GROUP_HEADER_MARKER = 0 ;
3535const char CHUNK_HEADER_MARKER = 1 ;
3636const char ONLY_ONE_PAGE_CHUNK_HEADER_MARKER = 5 ;
@@ -104,13 +104,14 @@ int TSMIterator::init() {
104104 chunk_meta_iter_++;
105105 }
106106 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;
109109 }
110110
111111 chunk_group_meta_iter_++;
112112 }
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 ()) {
114115 tsm_measurement_iter_ = tsm_chunk_meta_info_.begin ()->second .begin ();
115116 }
116117 tsm_device_iter_ = tsm_chunk_meta_info_.begin ();
@@ -121,7 +122,8 @@ bool TSMIterator::has_next() const {
121122 return tsm_device_iter_ != tsm_chunk_meta_info_.end ();
122123}
123124
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,
125127 TimeseriesIndex &ret_ts_index) {
126128 int ret = E_OK;
127129 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
153155 ret_ts_index.set_data_type (data_type);
154156 ret_ts_index.init_statistic (data_type);
155157
156-
157158 SimpleList<ChunkMeta *>::Iterator ts_chunk_meta_iter =
158159 chunk_meta_list_of_this_ts.begin ();
159160 for (;
@@ -199,9 +200,10 @@ int TsFileMeta::serialize_to(common::ByteStream &out) {
199200 }
200201
201202 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_) {
203204 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);
205207 }
206208
207209 return out.total_size () - start_idx;
@@ -250,24 +252,26 @@ int TsFileMeta::deserialize_from(common::ByteStream &in) {
250252 int32_t tsfile_properties_size = 0 ;
251253 common::SerializationUtil::read_var_int (tsfile_properties_size, in);
252254 for (int i = 0 ; i < tsfile_properties_size; i++) {
253- std::string key, value;
255+ std::string key, * value;
254256 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);
257259 }
258260 return ret;
259261}
260262
261263/* ================ 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) {
265268#if DEBUG_SE
266269 std::cout << " MetaIndexNode::binary_search_children start, name=" << key
267270 << " , exact_search=" << exact_search
268271 << " , children_.size=" << children_.size () << std::endl;
269272 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;
271275 }
272276#endif
273277 bool is_aligned = false ;
@@ -298,7 +302,7 @@ int MetaIndexNode::binary_search_children(std::shared_ptr<IComparable> key, bool
298302 break ;
299303 } else if (cmp > 0 ) { // children_[m] > name
300304 h = m;
301- } else { // children_[m] < name
305+ } else { // children_[m] < name
302306 l = m;
303307 }
304308 }
0 commit comments