Skip to content

Commit d04580c

Browse files
committed
Upgrade rkyv to 0.8 and remove bytecheck
The rkyv 0.8 version is a major update that brings many improvements and new features. This patch adapts the API to version 0.8, removing the old API. Additionally, the key-value type in the test cases has been changed from HashMap to BTreeMap, as the data bytes of HashMap are no longer fixed in version 0.8. I suspect this is due to the unordered sorting of HashMap. After switching to BTreeMap, everything works fine.
1 parent d2cc9fb commit d04580c

File tree

5 files changed

+94
-139
lines changed

5 files changed

+94
-139
lines changed

Cargo.lock

Lines changed: 58 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ keywords = ["memory-mapping", "synchronization", "interprocess", "wait-free", "z
1414
categories = ["os", "filesystem", "concurrency", "data-structures", "memory-management"]
1515

1616
[dependencies]
17-
bytecheck = { version = "~0.6.8", default-features = false }
1817
memmap2 = "0.9.4"
19-
rkyv = { version = "0.7.40", features = ["validation", "strict"] }
18+
rkyv = "0.8.9"
2019
thiserror = "1.0.30"
2120
wyhash = "0.5.0"
2221

benches/synchronizer.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use std::time::Duration;
22

3-
use bytecheck::CheckBytes;
43
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
54
use pprof::criterion::PProfProfiler;
6-
use rkyv::{AlignedVec, Archive, Deserialize, Serialize};
5+
use rkyv::{util::AlignedVec, Archive, Deserialize, Serialize, rancor::Error as RkyvErr};
76
#[cfg(unix)]
87
use wyhash::WyHash;
98

@@ -12,7 +11,6 @@ use mmap_sync::locks::{LockDisabled, SingleWriter};
1211
use mmap_sync::synchronizer::Synchronizer;
1312
/// Example data-structure shared between writer and reader(s)
1413
#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
15-
#[archive_attr(derive(CheckBytes))]
1614
pub struct HelloWorld {
1715
pub version: u32,
1816
pub messages: Vec<String>,
@@ -23,7 +21,7 @@ fn build_mock_data() -> (HelloWorld, AlignedVec) {
2321
version: 7,
2422
messages: vec!["Hello".to_string(), "World".to_string(), "!".to_string()],
2523
};
26-
let bytes = rkyv::to_bytes::<HelloWorld, 1024>(&data).unwrap();
24+
let bytes = rkyv::to_bytes::<RkyvErr>(&data).unwrap();
2725

2826
(data, bytes)
2927
}

examples/common/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use bytecheck::CheckBytes;
21
use rkyv::{Archive, Deserialize, Serialize};
32

43
/// Example data-structure shared between writer and reader(s)
54
#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
6-
#[archive_attr(derive(CheckBytes))]
5+
#[rkyv(compare(PartialEq), derive(Debug))]
76
pub struct HelloWorld {
87
pub version: u32,
98
pub messages: Vec<String>,

0 commit comments

Comments
 (0)