Zero-copy deserialization of Sieve scripts and reports + Bump multiple dependencies to their latest versions

This commit is contained in:
mdecimus
2025-05-11 16:56:55 +02:00
parent 095c501a66
commit 7ec5701af8
112 changed files with 1109 additions and 1816 deletions

View File

@@ -10,8 +10,8 @@ nlp = { path = "../nlp" }
trc = { path = "../trc" }
rocksdb = { version = "0.23", optional = true, features = ["multi-threaded-cf"] }
foundationdb = { version = "0.9.2", features = ["embedded-fdb-include", "fdb-7_3"], optional = true }
rusqlite = { version = "0.34", features = ["bundled"], optional = true }
rust-s3 = { version = "=0.35.0-alpha.2", default-features = false, features = ["tokio-rustls-tls", "no-verify-ssl"], optional = true }
rusqlite = { version = "0.35", features = ["bundled"], optional = true }
rust-s3 = { version = "0.35", default-features = false, features = ["tokio-rustls-tls", "no-verify-ssl"], optional = true }
azure_core = { version = "0.21.0", optional = true }
azure_storage = { version = "0.21.0", default-features = false, features = ["enable_reqwest_rustls", "hmac_rust"], optional = true }
azure_storage_blobs = { version = "0.21.0", default-features = false, features = ["enable_reqwest_rustls", "hmac_rust"], optional = true }
@@ -38,7 +38,7 @@ rustls = { version = "0.23.5", optional = true, default-features = false, featur
rustls-pki-types = { version = "1", optional = true }
ring = { version = "0.17", optional = true }
bytes = { version = "1.0", optional = true }
mysql_async = { version = "=0.34.1", default-features = false, features = ["default-rustls"], optional = true }
mysql_async = { version = "0.36", default-features = false, features = ["default-rustls-ring", "minimal"], optional = true }
elasticsearch = { version = "8.5.0-alpha.1", default-features = false, features = ["rustls-tls"], optional = true }
serde_json = {version = "1.0.64", optional = true }
regex = "1.7.0"
@@ -46,7 +46,6 @@ flate2 = "1.0"
async-trait = "0.1.68"
redis = { version = "0.29", features = [ "tokio-comp", "tokio-rustls-comp", "tls-rustls-insecure", "tls-rustls-webpki-roots", "cluster-async"], optional = true }
deadpool = { version = "0.12", features = ["managed"], optional = true }
bincode = "1.3.3"
arc-swap = "1.6.0"
bitpacking = "0.9.2"
memchr = { version = "2" }

View File

@@ -13,7 +13,7 @@ use utils::{
};
pub struct S3Store {
bucket: Bucket,
bucket: Box<Bucket>,
prefix: Option<String>,
max_retries: u32,
}

View File

@@ -88,6 +88,7 @@ pub const SERIALIZE_CALENDAR_V1: u8 = 13;
pub const SERIALIZE_ADDRESSBOOK_V1: u8 = 14;
pub const SERIALIZE_CALENDAREVENT_V1: u8 = 15;
pub const SERIALIZE_PRINCIPAL_V1: u8 = 16;
pub const SERIALIZE_REPORT_V1: u8 = 17;
pub trait SerializedVersion {
fn serialize_version() -> u8;

View File

@@ -60,14 +60,6 @@ where
>,
>;
#[derive(Debug)]
pub struct LegacyBincode<T: serde::Serialize + serde::de::DeserializeOwned> {
pub inner: T,
}
#[derive(Debug, PartialEq, Clone, Eq, Hash)]
pub struct DynamicDocumentId(pub usize);
#[derive(Debug, Default)]
pub struct AssignedIds {
pub counter_ids: Vec<i64>,

View File

@@ -4,13 +4,11 @@
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
use super::{ARCHIVE_ALIGNMENT, AlignedBytes, Archive, Archiver};
use crate::{Deserialize, Serialize, SerializeInfallible, SerializedVersion, U32_LEN, Value};
use compact_str::format_compact;
use rkyv::util::AlignedVec;
use crate::{Deserialize, Serialize, SerializeInfallible, SerializedVersion, U32_LEN, Value};
use super::{ARCHIVE_ALIGNMENT, AlignedBytes, Archive, Archiver, LegacyBincode};
const MAGIC_MARKER: u8 = 1 << 7;
const LZ4_COMPRESSED: u8 = 1 << 6;
const ARCHIVE_UNCOMPRESSED: u8 = MAGIC_MARKER;
@@ -483,55 +481,8 @@ impl Deserialize for () {
}
}
impl<T: serde::Serialize + serde::de::DeserializeOwned> LegacyBincode<T> {
pub fn new(inner: T) -> Self {
Self { inner }
}
}
impl<T: serde::Serialize + serde::de::DeserializeOwned> Serialize for LegacyBincode<T> {
fn serialize(&self) -> trc::Result<Vec<u8>> {
bincode::serialize(&self.inner)
.map(|bytes| lz4_flex::compress_prepend_size(&bytes))
.map_err(|err| {
trc::StoreEvent::DeserializeError
.caused_by(trc::location!())
.reason(err)
})
}
}
impl<T: serde::Serialize + serde::de::DeserializeOwned + Sized + Sync + Send> Deserialize
for LegacyBincode<T>
{
fn deserialize(bytes: &[u8]) -> trc::Result<Self> {
lz4_flex::decompress_size_prepended(bytes)
.map_err(|err| {
trc::StoreEvent::DecompressError
.ctx(trc::Key::Value, bytes)
.caused_by(trc::location!())
.reason(err)
})
.and_then(|result| {
bincode::deserialize(&result).map_err(|err| {
trc::StoreEvent::DataCorruption
.ctx(trc::Key::Value, bytes)
.caused_by(trc::location!())
.reason(err)
})
})
.map(|inner| Self { inner })
}
}
impl<T> From<Value<'static>> for Archive<T> {
fn from(_: Value<'static>) -> Self {
unimplemented!()
}
}
impl<T: serde::Serialize + serde::de::DeserializeOwned> From<Value<'static>> for LegacyBincode<T> {
fn from(_: Value<'static>) -> Self {
unimplemented!()
}
}