diff --git a/src/lib.rs b/src/lib.rs index 4577fd5c..53400886 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)] diff --git a/src/runtime.rs b/src/runtime.rs index 515e2b75..c83ad8ee 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -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 where QC: QueryContext, { - storage: Arc, + shared_state: Arc>, execution_stack: RefCell>, } +struct SharedState +where + QC: QueryContext, +{ + storage: QC::QueryContextStorage, + revision: AtomicU64, +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] +pub struct Revision { + generation: usize, +} + impl Default for Runtime 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(