Skip to content

Commit 1d21e0a

Browse files
committed
Be explicit with naming
1 parent da9f4ad commit 1d21e0a

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

crates/store/re_log_encoding/src/decoder/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub fn options_from_bytes(bytes: &[u8]) -> Result<(CrateVersion, EncodingOptions
142142
warn_on_version_mismatch(version);
143143

144144
match options.serializer {
145-
Serializer::MsgPack | Serializer::Protobuf => {}
145+
Serializer::LegacyMsgPack | Serializer::Protobuf => {}
146146
}
147147

148148
Ok((CrateVersion::from_bytes(version), options))
@@ -323,7 +323,7 @@ impl<R: std::io::Read> Iterator for Decoder<R> {
323323
_ => return Some(Err(err)),
324324
},
325325
},
326-
Serializer::MsgPack => {
326+
Serializer::LegacyMsgPack => {
327327
let header = match LegacyMessageHeader::decode(&mut self.read) {
328328
Ok(header) => header,
329329
Err(err) => match err {

crates/store/re_log_encoding/src/decoder/stream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl StreamDecoder {
110110
self.options = options;
111111

112112
match self.options.serializer {
113-
Serializer::MsgPack => self.state = State::MsgPackMessageHeader,
113+
Serializer::LegacyMsgPack => self.state = State::MsgPackMessageHeader,
114114
Serializer::Protobuf => self.state = State::ProtobufMessageHeader,
115115
}
116116

crates/store/re_log_encoding/src/decoder/streaming.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl<R: AsyncBufRead + Unpin> Stream for StreamingDecoder<R> {
187187
}
188188

189189
let (msg, processed_length) = match serializer {
190-
crate::Serializer::MsgPack => {
190+
crate::Serializer::LegacyMsgPack => {
191191
let header_size = super::LegacyMessageHeader::SIZE;
192192
if unprocessed_bytes.len() < header_size {
193193
// Not enough data to read the header, need to wait for more

crates/store/re_log_encoding/src/encoder.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
//! Encoding of [`LogMsg`]es as a binary stream, e.g. to store in an `.rrd` file, or send over network.
22
3-
use crate::codec;
4-
use crate::codec::file::{self, encoder};
5-
use crate::FileHeader;
6-
use crate::LegacyMessageHeader;
7-
use crate::Serializer;
8-
use crate::{Compression, EncodingOptions};
93
use re_build_info::CrateVersion;
104
use re_chunk::{ChunkError, ChunkResult};
115
use re_log_types::LogMsg;
126

7+
use crate::{
8+
codec::{
9+
self,
10+
file::{self, encoder},
11+
},
12+
Compression, EncodingOptions, FileHeader, Serializer,
13+
};
14+
1315
// ----------------------------------------------------------------------------
1416

1517
/// On failure to encode or serialize a [`LogMsg`].
@@ -161,7 +163,7 @@ impl<W: std::io::Write> Encoder<W> {
161163
.map(|_| self.scratch.len() as _)
162164
.map_err(EncodeError::Write)
163165
}
164-
Serializer::MsgPack => Err(EncodeError::CannotEncodeWithMsgPack),
166+
Serializer::LegacyMsgPack => Err(EncodeError::CannotEncodeWithMsgPack),
165167
}
166168
}
167169

@@ -170,7 +172,7 @@ impl<W: std::io::Write> Encoder<W> {
170172
#[inline]
171173
pub fn finish(&mut self) -> Result<(), EncodeError> {
172174
match self.serializer {
173-
Serializer::MsgPack => {
175+
Serializer::LegacyMsgPack => {
174176
return Err(EncodeError::CannotEncodeWithMsgPack);
175177
}
176178
Serializer::Protobuf => {

crates/store/re_log_encoding/src/lib.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ pub enum Compression {
5050
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5151
#[repr(u8)]
5252
pub enum Serializer {
53-
MsgPack = 1,
53+
/// For Rerun 0.22 and earlier. Only used to support loading old files.
54+
LegacyMsgPack = 1,
55+
5456
Protobuf = 2,
5557
}
5658

@@ -79,7 +81,7 @@ impl EncodingOptions {
7981
_ => return Err(OptionsError::UnknownCompression(compression)),
8082
};
8183
let serializer = match serializer {
82-
1 => Serializer::MsgPack,
84+
1 => Serializer::LegacyMsgPack,
8385
2 => Serializer::Protobuf,
8486
_ => return Err(OptionsError::UnknownSerializer(serializer)),
8587
};
@@ -112,12 +114,6 @@ pub enum OptionsError {
112114
#[error("Unknown compression: {0}")]
113115
UnknownCompression(u8),
114116

115-
// TODO(jan): Remove this at some point, realistically 1-2 releases after 0.23
116-
#[error(
117-
"You are trying to load an old .rrd file that's not supported by this version of Rerun."
118-
)]
119-
RemovedMsgPackSerializer,
120-
121117
#[error("Unknown serializer: {0}")]
122118
UnknownSerializer(u8),
123119
}

0 commit comments

Comments
 (0)