use crate::db::{
data::{CanonicalRow, DataStore, RawDataStoreKey},
index::{IndexEntryValue, IndexStore, RawIndexStoreKey},
};
use std::{cell::RefCell, thread::LocalKey};
#[derive(Clone)]
pub(crate) struct PreparedIndexMutation {
pub(crate) index_store: &'static LocalKey<RefCell<IndexStore>>,
pub(crate) key: RawIndexStoreKey,
pub(crate) value: Option<IndexEntryValue>,
}
impl PreparedIndexMutation {
pub(crate) const fn new(
index_store: &'static LocalKey<RefCell<IndexStore>>,
key: RawIndexStoreKey,
value: Option<IndexEntryValue>,
) -> Self {
Self {
index_store,
key,
value,
}
}
}
#[derive(Clone)]
pub(in crate::db) struct PreparedRowCommitOp {
pub(crate) index_ops: Vec<PreparedIndexMutation>,
pub(crate) data_store: &'static LocalKey<RefCell<DataStore>>,
pub(crate) data_index_store: &'static LocalKey<RefCell<IndexStore>>,
pub(crate) data_key: RawDataStoreKey,
pub(crate) data_value: Option<CanonicalRow>,
}