| 123 | |
| 124 | template <size_t BATCH_SIZE> |
| 125 | int FlatBuilder<BATCH_SIZE>::dump(const IndexDumper::Pointer &dumper) { |
| 126 | ailego::ElapsedTime stamp; |
| 127 | if (!holder_) { |
| 128 | return IndexError_NoReady; |
| 129 | } |
| 130 | |
| 131 | std::vector<uint64_t> keys; |
| 132 | if (meta_.major_order() == IndexMeta::MO_COLUMN) { |
| 133 | int error_code = this->write_column_index(dumper.get(), &keys); |
| 134 | if (error_code != 0) { |
| 135 | return error_code; |
| 136 | } |
| 137 | } else { |
| 138 | int error_code = this->write_row_index(dumper.get(), &keys); |
| 139 | if (error_code != 0) { |
| 140 | return error_code; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | int error_code = this->write_keys(keys, dumper.get()); |
| 145 | if (error_code != 0) { |
| 146 | return error_code; |
| 147 | } |
| 148 | |
| 149 | error_code = this->write_mapping(keys, dumper.get()); |
| 150 | if (error_code != 0) { |
| 151 | return error_code; |
| 152 | } |
| 153 | |
| 154 | error_code = IndexHelper::SerializeToDumper(meta_, dumper.get()); |
| 155 | if (error_code != 0) { |
| 156 | return error_code; |
| 157 | } |
| 158 | |
| 159 | stats_.set_dumped_count(keys.size()); |
| 160 | stats_.set_dumped_costtime(stamp.milli_seconds()); |
| 161 | return 0; |
| 162 | } |
| 163 | |
| 164 | template <size_t BATCH_SIZE> |
| 165 | int FlatBuilder<BATCH_SIZE>::write_keys(const std::vector<uint64_t> &keys, |
nothing calls this directly
no test coverage detected