size: [17, 41]
(stats: &ProcessingStats, buf: &mut Vec<u8>)
| 118 | |
| 119 | // size: [17, 41] |
| 120 | pub fn serialize_processing_stats(stats: &ProcessingStats, buf: &mut Vec<u8>) { |
| 121 | buf.extend_from_slice(&stats.records_upserted.to_le_bytes()); |
| 122 | buf.extend_from_slice(&stats.records_deleted.to_le_bytes()); |
| 123 | buf.extend_from_slice(&stats.total_operations.to_le_bytes()); |
| 124 | buf.extend_from_slice(&stats.percentage_complete.to_le_bytes()); |
| 125 | |
| 126 | let mut flags_byte = 0; |
| 127 | let flags_idx = buf.len(); |
| 128 | buf.push(flags_byte); |
| 129 | |
| 130 | if let Some(processing_time_seconds) = stats.processing_time_seconds { |
| 131 | buf.extend_from_slice(&processing_time_seconds.to_le_bytes()); |
| 132 | flags_byte |= 1; |
| 133 | } |
| 134 | |
| 135 | if let Some(average_throughput) = stats.average_throughput { |
| 136 | buf.extend_from_slice(&average_throughput.to_le_bytes()); |
| 137 | flags_byte |= 2; |
| 138 | } |
| 139 | |
| 140 | if let Some(current_processing_rate) = stats.current_processing_rate { |
| 141 | buf.extend_from_slice(¤t_processing_rate.to_le_bytes()); |
| 142 | flags_byte |= 4; |
| 143 | } |
| 144 | |
| 145 | if let Some(estimated_completion) = stats.estimated_completion { |
| 146 | buf.extend_from_slice(&estimated_completion.timestamp().to_le_bytes()); |
| 147 | flags_byte |= 8; |
| 148 | } |
| 149 | |
| 150 | if let Some(version_created) = stats.version_created { |
| 151 | buf.extend_from_slice(&version_created.to_le_bytes()); |
| 152 | flags_byte |= 16; |
| 153 | } |
| 154 | |
| 155 | buf[flags_idx] = flags_byte; |
| 156 | } |
| 157 | |
| 158 | pub fn deserialize_processing_stats( |
| 159 | bufman: &BufferManager, |