Skip to content

Commit

Permalink
Upgrade rkyv to 0.8 and remove bytecheck
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ssfdust committed Dec 5, 2024
1 parent d2cc9fb commit d04580c
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 139 deletions.
156 changes: 58 additions & 98 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ keywords = ["memory-mapping", "synchronization", "interprocess", "wait-free", "z
categories = ["os", "filesystem", "concurrency", "data-structures", "memory-management"]

[dependencies]
bytecheck = { version = "~0.6.8", default-features = false }
memmap2 = "0.9.4"
rkyv = { version = "0.7.40", features = ["validation", "strict"] }
rkyv = "0.8.9"
thiserror = "1.0.30"
wyhash = "0.5.0"

Expand Down
6 changes: 2 additions & 4 deletions benches/synchronizer.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::time::Duration;

use bytecheck::CheckBytes;
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
use pprof::criterion::PProfProfiler;
use rkyv::{AlignedVec, Archive, Deserialize, Serialize};
use rkyv::{util::AlignedVec, Archive, Deserialize, Serialize, rancor::Error as RkyvErr};
#[cfg(unix)]
use wyhash::WyHash;

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

(data, bytes)
}
Expand Down
3 changes: 1 addition & 2 deletions examples/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use bytecheck::CheckBytes;
use rkyv::{Archive, Deserialize, Serialize};

/// Example data-structure shared between writer and reader(s)
#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
#[archive_attr(derive(CheckBytes))]
#[rkyv(compare(PartialEq), derive(Debug))]
pub struct HelloWorld {
pub version: u32,
pub messages: Vec<String>,
Expand Down
Loading

0 comments on commit d04580c

Please sign in to comment.