mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-12-27 06:27:45 +00:00
refactor to have a revision and shared state in runtime
Pare down our feature list to what we actually *use*
This commit is contained in:
parent
72a5b50368
commit
2e7e77516e
2 changed files with 21 additions and 7 deletions
|
@ -2,10 +2,7 @@
|
|||
#![feature(in_band_lifetimes)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(nll)]
|
||||
#![feature(min_const_fn)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_let)]
|
||||
#![feature(try_from)]
|
||||
#![feature(integer_atomics)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
|
|
|
@ -2,23 +2,40 @@ use crate::Query;
|
|||
use crate::QueryContext;
|
||||
use std::cell::RefCell;
|
||||
use std::fmt::Write;
|
||||
use std::sync::atomic::AtomicU64;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Runtime<QC>
|
||||
where
|
||||
QC: QueryContext,
|
||||
{
|
||||
storage: Arc<QC::QueryContextStorage>,
|
||||
shared_state: Arc<SharedState<QC>>,
|
||||
execution_stack: RefCell<Vec<QC::QueryDescriptor>>,
|
||||
}
|
||||
|
||||
struct SharedState<QC>
|
||||
where
|
||||
QC: QueryContext,
|
||||
{
|
||||
storage: QC::QueryContextStorage,
|
||||
revision: AtomicU64,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct Revision {
|
||||
generation: usize,
|
||||
}
|
||||
|
||||
impl<QC> Default for Runtime<QC>
|
||||
where
|
||||
QC: QueryContext,
|
||||
{
|
||||
fn default() -> Self {
|
||||
Runtime {
|
||||
storage: Arc::default(),
|
||||
shared_state: Arc::new(SharedState {
|
||||
storage: Default::default(),
|
||||
revision: Default::default(),
|
||||
}),
|
||||
execution_stack: RefCell::default(),
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +46,7 @@ where
|
|||
QC: QueryContext,
|
||||
{
|
||||
pub fn storage(&self) -> &QC::QueryContextStorage {
|
||||
&self.storage
|
||||
&self.shared_state.storage
|
||||
}
|
||||
|
||||
crate fn execute_query_implementation<Q>(
|
||||
|
|
Loading…
Reference in a new issue