feat: use postcard for redis serde (#6956)

* redo error handling in xredis

* give proper types to metadata fields

* add round-trip tests

* inline loader enum metadata fields

* postcard roundtrips

* prepare

* bump redis key version

* serde-binhum

* clippy

* fix

* fix frontend checking existence of component fields rather than non-null-ness

* prepare
This commit is contained in:
aecsocket
2026-08-05 10:36:05 +00:00
committed by GitHub
parent cc53d9a6f8
commit 5148e8ec35
70 changed files with 1713 additions and 646 deletions
+3 -14
View File
@@ -3,11 +3,10 @@ use std::sync::atomic::{AtomicBool, Ordering};
use dashmap::DashMap;
use dashmap::mapref::entry::Entry;
use eyre::{Result, WrapErr};
use tokio::sync::Notify;
use tokio::time::{Instant, timeout_at};
use crate::Error;
#[derive(Clone)]
pub(in crate::cache) struct LockCoordinator {
locks: Arc<DashMap<String, Arc<LockState>>>,
@@ -76,10 +75,7 @@ pub(in crate::cache) struct LockWaiter {
}
impl LockWaiter {
pub(in crate::cache) async fn wait(
self,
deadline: Instant,
) -> Result<(), Error> {
pub(in crate::cache) async fn wait(self, deadline: Instant) -> Result<()> {
loop {
if self.state.released.load(Ordering::Acquire) {
return Ok(());
@@ -94,7 +90,7 @@ impl LockWaiter {
timeout_at(deadline, notified)
.await
.map_err(|_| lock_timeout())?;
.wrap_err("waiting for local Redis cache lock")?;
}
}
}
@@ -112,10 +108,3 @@ impl LockState {
}
}
}
fn lock_timeout() -> Error {
Error::LocalCacheTimeout {
released: 0,
total: 1,
}
}