|
6 | 6 | use protobuf::CodedOutputStream; |
7 | 7 | use saluki_error::GenericError; |
8 | 8 |
|
| 9 | +use super::constants::*; |
9 | 10 | use super::interner::Interner; |
10 | | -use super::types::{field_numbers, value_type_for_values, V3MetricType, V3ValueType}; |
| 11 | +use super::types::{value_type_for_values, V3MetricType, V3ValueType}; |
11 | 12 |
|
12 | 13 | const METRIC_TYPE_DEFAULT: i32 = 0; |
13 | 14 | const METRIC_TYPE_AGENT_HIDDEN: i32 = 9; |
@@ -183,49 +184,49 @@ impl V3Writer { |
183 | 184 |
|
184 | 185 | // Dictionary fields (bytes - varint-length-prefixed strings concatenated) |
185 | 186 | if !data.dict_name_bytes.is_empty() { |
186 | | - os.write_bytes(field_numbers::DICT_NAME_STR, &data.dict_name_bytes)?; |
| 187 | + os.write_bytes(DICT_NAME_STR_FIELD_NUMBER, &data.dict_name_bytes)?; |
187 | 188 | } |
188 | 189 | if !data.dict_tags_bytes.is_empty() { |
189 | | - os.write_bytes(field_numbers::DICT_TAGS_STR, &data.dict_tags_bytes)?; |
| 190 | + os.write_bytes(DICT_TAGS_STR_FIELD_NUMBER, &data.dict_tags_bytes)?; |
190 | 191 | } |
191 | 192 |
|
192 | 193 | // Packed repeated fields for dictionaries |
193 | | - os.write_repeated_packed_sint64(field_numbers::DICT_TAGSETS, &data.dict_tagsets)?; |
| 194 | + os.write_repeated_packed_sint64(DICT_TAGSETS_FIELD_NUMBER, &data.dict_tagsets)?; |
194 | 195 |
|
195 | 196 | if !data.dict_resource_str_bytes.is_empty() { |
196 | | - os.write_bytes(field_numbers::DICT_RESOURCE_STR, &data.dict_resource_str_bytes)?; |
| 197 | + os.write_bytes(DICT_RESOURCE_STR_FIELD_NUMBER, &data.dict_resource_str_bytes)?; |
197 | 198 | } |
198 | 199 |
|
199 | | - os.write_repeated_packed_int64(field_numbers::DICT_RESOURCE_LEN, &data.dict_resource_len)?; |
200 | | - os.write_repeated_packed_sint64(field_numbers::DICT_RESOURCE_TYPE, &data.dict_resource_type)?; |
201 | | - os.write_repeated_packed_sint64(field_numbers::DICT_RESOURCE_NAME, &data.dict_resource_name)?; |
| 200 | + os.write_repeated_packed_int64(DICT_RESOURCE_LEN_FIELD_NUMBER, &data.dict_resource_len)?; |
| 201 | + os.write_repeated_packed_sint64(DICT_RESOURCE_TYPE_FIELD_NUMBER, &data.dict_resource_type)?; |
| 202 | + os.write_repeated_packed_sint64(DICT_RESOURCE_NAME_FIELD_NUMBER, &data.dict_resource_name)?; |
202 | 203 |
|
203 | 204 | if !data.dict_source_type_bytes.is_empty() { |
204 | | - os.write_bytes(field_numbers::DICT_SOURCE_TYPE_NAME, &data.dict_source_type_bytes)?; |
| 205 | + os.write_bytes(DICT_SOURCE_TYPE_NAME_FIELD_NUMBER, &data.dict_source_type_bytes)?; |
205 | 206 | } |
206 | 207 |
|
207 | | - os.write_repeated_packed_int32(field_numbers::DICT_ORIGIN_INFO, &data.dict_origin_info)?; |
| 208 | + os.write_repeated_packed_int32(DICT_ORIGIN_INFO_FIELD_NUMBER, &data.dict_origin_info)?; |
208 | 209 |
|
209 | 210 | // Per-metric columns |
210 | | - os.write_repeated_packed_uint64(field_numbers::TYPES, &data.types)?; |
211 | | - os.write_repeated_packed_sint64(field_numbers::NAMES, &data.names)?; |
212 | | - os.write_repeated_packed_sint64(field_numbers::TAGS, &data.tags)?; |
213 | | - os.write_repeated_packed_sint64(field_numbers::RESOURCES, &data.resources)?; |
214 | | - os.write_repeated_packed_uint64(field_numbers::INTERVALS, &data.intervals)?; |
215 | | - os.write_repeated_packed_uint64(field_numbers::NUM_POINTS, &data.num_points)?; |
216 | | - os.write_repeated_packed_sint64(field_numbers::SOURCE_TYPE_NAME, &data.source_type_names)?; |
217 | | - os.write_repeated_packed_sint64(field_numbers::ORIGIN_INFO, &data.origin_infos)?; |
| 211 | + os.write_repeated_packed_uint64(TYPES_FIELD_NUMBER, &data.types)?; |
| 212 | + os.write_repeated_packed_sint64(NAMES_FIELD_NUMBER, &data.names)?; |
| 213 | + os.write_repeated_packed_sint64(TAGS_FIELD_NUMBER, &data.tags)?; |
| 214 | + os.write_repeated_packed_sint64(RESOURCES_FIELD_NUMBER, &data.resources)?; |
| 215 | + os.write_repeated_packed_uint64(INTERVALS_FIELD_NUMBER, &data.intervals)?; |
| 216 | + os.write_repeated_packed_uint64(NUM_POINTS_FIELD_NUMBER, &data.num_points)?; |
| 217 | + os.write_repeated_packed_sint64(SOURCE_TYPE_NAME_FIELD_NUMBER, &data.source_type_names)?; |
| 218 | + os.write_repeated_packed_sint64(ORIGIN_INFO_FIELD_NUMBER, &data.origin_infos)?; |
218 | 219 |
|
219 | 220 | // Point data |
220 | | - os.write_repeated_packed_sint64(field_numbers::TIMESTAMPS, &data.timestamps)?; |
221 | | - os.write_repeated_packed_sint64(field_numbers::VALS_SINT64, &data.vals_sint64)?; |
222 | | - os.write_repeated_packed_float(field_numbers::VALS_FLOAT32, &data.vals_float32)?; |
223 | | - os.write_repeated_packed_double(field_numbers::VALS_FLOAT64, &data.vals_float64)?; |
| 221 | + os.write_repeated_packed_sint64(TIMESTAMPS_FIELD_NUMBER, &data.timestamps)?; |
| 222 | + os.write_repeated_packed_sint64(VALS_SINT64_FIELD_NUMBER, &data.vals_sint64)?; |
| 223 | + os.write_repeated_packed_float(VALS_FLOAT32_FIELD_NUMBER, &data.vals_float32)?; |
| 224 | + os.write_repeated_packed_double(VALS_FLOAT64_FIELD_NUMBER, &data.vals_float64)?; |
224 | 225 |
|
225 | 226 | // Sketch data |
226 | | - os.write_repeated_packed_uint64(field_numbers::SKETCH_NUM_BINS, &data.sketch_num_bins)?; |
227 | | - os.write_repeated_packed_sint32(field_numbers::SKETCH_BIN_KEYS, &data.sketch_bin_keys)?; |
228 | | - os.write_repeated_packed_uint32(field_numbers::SKETCH_BIN_CNTS, &data.sketch_bin_cnts)?; |
| 227 | + os.write_repeated_packed_uint64(SKETCH_NUM_BINS_FIELD_NUMBER, &data.sketch_num_bins)?; |
| 228 | + os.write_repeated_packed_sint32(SKETCH_BIN_KEYS_FIELD_NUMBER, &data.sketch_bin_keys)?; |
| 229 | + os.write_repeated_packed_uint32(SKETCH_BIN_CNTS_FIELD_NUMBER, &data.sketch_bin_cnts)?; |
229 | 230 |
|
230 | 231 | os.flush()?; |
231 | 232 | Ok(()) |
|
0 commit comments