Remove GlobalSessions DB entry

If we read the currently-being-evaluated session from the evaluator, we can
avoid paying the storage costs on all sessions ad-infinitum.
This commit is contained in:
Luke Parker
2024-12-25 23:51:24 -05:00
parent 2aebfb21af
commit f336ab1ece
4 changed files with 79 additions and 53 deletions

View File

@@ -144,17 +144,17 @@ macro_rules! db_channel {
Self::set(txn, $($arg,)* index_to_use, value);
}
pub(crate) fn peek(
txn: &mut impl DbTxn
getter: &impl Get
$(, $arg: $arg_type)*
) -> Option<$field_type> {
let messages_recvd_key = Self::key($($arg,)* 1);
let messages_recvd = txn.get(&messages_recvd_key).map(|counter| {
let messages_recvd = getter.get(&messages_recvd_key).map(|counter| {
u32::from_le_bytes(counter.try_into().unwrap())
}).unwrap_or(0);
let index_to_read = messages_recvd + 2;
Self::get(txn, $($arg,)* index_to_read)
Self::get(getter, $($arg,)* index_to_read)
}
pub(crate) fn try_recv(
txn: &mut impl DbTxn