Fix queue migration
This commit is contained in:
@@ -179,7 +179,7 @@ pub(crate) async fn migrate_queue_v012(server: &Server) -> trc::Result<()> {
|
||||
.await
|
||||
.and_then(|archive| {
|
||||
if let Some(archive) = archive {
|
||||
archive.deserialize::<MessageV012>().map(Some)
|
||||
archive.deserialize_untrusted::<MessageV012>().map(Some)
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
@@ -209,7 +209,7 @@ pub(crate) async fn migrate_queue_v012(server: &Server) -> trc::Result<()> {
|
||||
.await
|
||||
.and_then(|archive| {
|
||||
if let Some(archive) = archive {
|
||||
archive.deserialize::<Message>().map(Some)
|
||||
archive.deserialize_untrusted::<Message>().map(Some)
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
@@ -395,6 +395,7 @@ pub struct LegacyMessage<SIZE, IDX> {
|
||||
pub quota_keys: Vec<QuotaKey>,
|
||||
|
||||
#[serde(skip)]
|
||||
#[rkyv(with = rkyv::with::Skip)]
|
||||
pub span_id: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -302,6 +302,23 @@ impl Archive<AlignedBytes> {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn deserialize_untrusted<T>(&self) -> trc::Result<T>
|
||||
where
|
||||
T: rkyv::Archive,
|
||||
T::Archived: for<'a> rkyv::bytecheck::CheckBytes<
|
||||
rkyv::api::high::HighValidator<'a, rkyv::rancor::Error>,
|
||||
> + rkyv::Deserialize<T, rkyv::api::high::HighDeserializer<rkyv::rancor::Error>>,
|
||||
{
|
||||
self.unarchive_untrusted::<T>().and_then(|input| {
|
||||
rkyv::deserialize(input).map_err(|err| {
|
||||
trc::StoreEvent::DeserializeError
|
||||
.ctx(trc::Key::Value, self.as_bytes())
|
||||
.caused_by(trc::location!())
|
||||
.reason(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
pub fn to_unarchived<T>(&self) -> trc::Result<Archive<&<T as rkyv::Archive>::Archived>>
|
||||
where
|
||||
T: rkyv::Archive,
|
||||
|
||||
Reference in New Issue
Block a user